Thursday, March 6, 2014

Record your command line..

Sometimes every once in a while, you find an old generally unused command, but now you find it is very valuable. One such command is know as ttyrec. As the name suggests, you can probably record what is typed at the terminal.   This is excellent for documentation purposes. It is a must for people who do any amount of work on the command line.  An example: recently did a remote install of Arch linux on a remote machine.  It would have been nice to have a record of all the work done.

# sudo apt-get install ttyrec

Well how do you use it? There are actually two parts of the system. ttyrec does the recording and ttyplay  will playback what you have recorded.  So you will want to invoke ttyrec with a filename (for later playback,) which will generate a new shell or prompt.  Go ahead and type in the commands you want to do, then when you are finished, use <control>d to exit the the recording. You will see the word exit to confirm the exit of the ttyrec program.

$ ttyrec filename
$ echo hello world
hello world
$<control>d   exit

Now to playback what your have typed in exactly as you have typed it then use:

$ ttyshow filename

The playback will show everything as it was done like a movie.Now anytime you want to check out what you did during the recording session, it is at your fingertips. Also too makes for great educational media.

I especially like this program if I need to do a complicated install/records foul ups so they can be fixed also.

No comments:

Post a Comment