//
you're reading...
Tips

Logging Your Linux Terminal

Logging a Linux Terminal

Logging a Linux Terminal

Sometimes you need to log a terminal for one reason or another in linux for later reference and review. I recently required such a thing and with a little looking around I figure I would share it with everyone. There is a program that is called script that does this and then a bit. When we look at the man page for script we see the perfect description of what the program does.

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 typescript file can be printed out
later with lpr(1).

It is also possible to even replay the session logged in real time using a 2nd timing file. Logging a terminal session is as easy as doing script -c “ssh user@example.com” -t examplecom.session > examplecom.timing”. The -t switch and the redirection is optional depending if you want to replay the session in real time or just a hard copy of what happened.

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 inter‐preted differently by the terminal to which
scriptreplay is sending its output.

If you need to reply the session you can use scriptreplay to see what happened in real time and in keeping with the example above: scriptreply examplecom.timing examplecom.session. The description from the scriptreplay man is above.

 

 

Advertisements

About Pythorian

Exploration and Production oriented security consultant for securing IT infrastructures relating to natural resources.

Discussion

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: