Sign up ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

How do I keep logs of all the work done via terminal? For example, I want a record of all the work done on database via terminal.

share|improve this question
This is also built into sudo. –  Wilhelm Erasmus Jul 8 at 19:53

2 Answers 2

up vote 17 down vote accepted

When you are ready to start recording a log file, type:

script screen.log

Now, until you stop the script, all input and output in the Terminal will be stored in screen.log. When you are done, just type:


Your screen.log file will be in your Home folder (/home/user). This will do exactly what you are looking for.

Source: Ubuntu Guide - How To Log Terminal Commands

share|improve this answer
Hi, thanks for the reply. But will this work if I login to the mysql database from the shell using the following sequence:- 1) script screen.log 2)mysql -u <user> -p <database> 3) some work on the database 4) exit; I see that the file screen.log is created but it doesn't contain logs for the database. I'll share the file asap. Thanks Ankt –  Ankit Jul 10 '12 at 14:15
it should work with everything running in the console reading from "standard input" (usually your keyboard) and writing to standard output (usually your terminal window). So it should include the mysql command-line client. The man page (man script) even mentions vi (editor)... –  Izzy Jul 10 '12 at 14:21

You may want to try out Asciinema. In addition to just making a recording you get the ability to share it and embed the player on your blog, article or in a conference talk.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.