When learning Linux, sometimes the terminal printing message is very important to us, but the terminal display also has a certain buffer space, when the printing information is very long, the front of the information will be overwritten, so here online search for a bit of this introduction, now summarized as follows:
Script is a very useful tool, and it's fun enough. Script can record the session process of the terminal, and then use Scriptreplay to play the results of their recordings to others to watch. The benefit of script is that all of your operations in the terminal can be recorded in its own way. We can apply this recording in many ways, such as teaching, presentation, and so on.
In general, script and Scriptreplay have a default installation in the Linux distribution. If you plan to start recording a terminal session using script, you can do this by typing the following command:
Script-t 2>yangrui.timing-a yangrui.session
The-t option in this directive indicates the time data for the output recording, and the-a option outputs the recorded file (if the file already exists, the data is added later). You can change the Yangrui in the directive to the name of the file you set. When you return the message "Script started, file is Yangrui.session" in the terminal, you can do what you need to record.
If you need to end the recording process, enter
To play a terminal session that has been recorded, you can use the command:
Scriptreplay yangrui.timing yangrui.session
You can look at the action like a movie, but not fast forward (or maybe I haven't found it, and if any one knows, you can teach me by the way). Personal advice to use:
Cat Yangrui.session
View the content. If you open yangrui.session in the graphical interface, you'll find that the file will be filled with control characters and ANSI escape sequences that look like garbled:
The workaround can be found on the Internet, and personal advice is available on the command line.
Next time you want to continue recording, enter it again:
Script-t 2>yangrui.timing-a yangrui.session
It will put the recorded data behind the last data, and automatically separated by time.
For more information about script and Scriptreplay, you can use the man script or the man Scriptreplay query.