People tend to get immersed once they start their session with terminals or powershell. The underlying reasons can vary from trying to troubleshoot an issue to installing a new feature or just making a quick status checks. However, one action can lead to another and before we know it, something is broken!
If you know what the situation like that is, you definitely want to record your session when you go on messing around with critical systems next time. I will describe tools for linux and windows in this post.
For linux, script is a useful tool which comes pre-installed in most of the distributions. Basic usage of script is to call the command with a filename next in which you want to record the log of your session.
Script started, file is session.log
After completing your session, you can simply type exit or send ‘Ctrl+D’ key combination to terminate the logging.
Script done, file is session.log
Similar action can be done in windows platform using tool called start-transcript. It usage is similar to script where we execute the command followed by path to the log file.
PS C:\Users\Test>Start-Transcript -Path C:\Users\Test\log.txt
Transcript started, output file is log.txt
Once the session is completed, you can send the command Stop-Transcript to terminate the session.
Transcript stopped, output file is C:\Users\Test\log.txt