The script command is part of the util-linux-ng package and so should be available already installed in any distribution, or you should be able to easily add it.
What’s script ?
From his man page:
Script makes a typescript of everything printed on your terminal. It is useful for students who need a hardcopy record of an interactive session as proof of an assignment, as the type script file can be printed out later with lpr.
Basic usage from a terminal type
script this will start a new session and write all the command in the file typescript (in your home).
But now we’ll see how to use it to record a whole session and than replay it:
script -t -a /tmp/mylog.out 2&> /tmp/mylog.time;
-a Append the output to file or typescript, retaining the prior contents.
-t Output timing data to standard error. This data contains two fields, separated by a space. The first field indicates how much time elapsed since the previous output. The second field indicates how many characters were output this time. This information can be used to replay typescripts with realistic typing and output delays.
After this command do your work session and end it with ^D (Ctrl-D) or”exit”
Now you’ll find in /tmp the 2 files mylog.out and mylog.time.
scriptreplay /tmp/mylog.time /tmp/mylog.out
Sciptreplay it’s script companion, take as input the output produced with script and do a replay of them.
The replay simply displays the information again; the programs that were run when the typescript was being recorded are not run again. Since the same information is simply being displayed, scriptreplay is only guaranteed to work properly if run on the same type of terminal the typescript was recorded on. Otherwise, any escape characters in the typescript may be interpreted differently by the terminal to which scriptreplay is sending its output.
% script -t 2&> demo.timing -a demo.session Script started, file is demo.session % % exit Script done, file is demo.session % scriptreplay demo.timing demo.session
Example of scriptreplay:
- Reasons why 2015 will be year for Linux on the desktop
- Manage and read your ebooks on Linux with Calibre
- The Best Linux-Based Home Automation Systems for Under $300
Find me on Google+