In this tip we will see how to record all commands executed in the terminal along with returned outputs to a text file automatically. This may help you better troubleshoot your problems, and can be very helpful in forums to better describe your issue.

Getting Started

Open the terminal and run this command to start a session:

script file.txt

You can rename "file.txt" to whatever you want. The session is now started. All commands entered and returned outputs will now be recorded into the text file automatically. This file will be saved in the current folder. To stop recording, press CTRL+D. To continue recording in the same file, use this command:

script -a file.txt

You can view the file using Gedit or any other text editor. Or you can view it via the terminal with this command:

cat file.txt

 [NOTE]: This tip is workable under Ubuntu and other Linux-based distributions.

Post a Comment