Record terminal sessions using script
Most sys admins know the importance of keeping an action log where various tasks, configuration changes, etc. are kept. Simple logs indicating, "I did this" or "John did that" may be sufficient in some organizations, but for some, full transcripts of changes made are desired. Doing a copy-and-paste of terminal output can be tedious at best, so one answer is to use a little-known program called script, which is part of the util-linux package on most Linux distributions.
script records everything in a session: things you type and things you see. It even records color; so if your command prompt or program output contains color, script will record it.
To use script, simply execute:
When you're done, type exit. This will close down the script session and save the file. You can now examine the file using cat or any other program.
The downside of using script is the fact that it records all special characters, so your output file will be full of control characters and ansi escape sequences. This can be avoided by using a very Spartan shell with script:
|All times are GMT +5.5. The time now is 01:16.|