Just the other day I was moving /home out of the / partition and in doing so I wanted to record all of the actions and output so that I could save them for later user… or to blog about ;)
There are a couple of ways to go about saving all of that output.
The easiest way is to do this is to run the script command
[server][root][~]# script
By default, this creates the output as typescript
If you wanted to change the name of the output file, you would invoke it as
[server][root][~]# script output.txt
or any other file of your choosing.
That starts a recording session that will record what goes on during your terminal session.
If you want to record users shell session from login to exit
In the user’s .bash_profile, put something like
exec /path/to/ttyrec session-log-$(date +%Y%m%d-%H%M)
That will create a log file in the form of session-log-YYYYMMDD-HHMM
Pretty nifty stuff.