(tool Class) Linux notes terminal logging tool script

Source: Internet
Author: User
Tags control characters

When learning Linux, sometimes the terminal's print message is very important to us, but the terminal display also has a certain buffer space. When the information is printed many, the preceding information is overwritten. So here's an online search for a little bit about this. For example, the following are summarized:

Script is a very useful tool, and it's fun enough at the same time. Script can record the session process of the terminal and then use Scriptreplay to play the results of its recordings to others to watch. The advantage of script is that. All of your operations in the terminal, it can be recorded in the same way.

We are able to apply such recordings in a number of ways, such as teaching, presentations, and so on.


In general, script and Scriptreplay have a default installation in the Linux distribution. Suppose you plan to use script to start recording a terminal session and be able to typed the following commands:
Script-t 2>yangrui.timing-a yangrui.session
The-t option in this directive indicates the time data for the output recording, while the-a option outputs the recorded file (assuming that the file already exists, add the data later). You can change the Yangrui in the instruction to the file name you set. When the "Script started, file is yangrui.session" message is returned in the terminal. You'll be able to do what you need to record.



If you need to end the recording process, enter

To play a terminal session that has been recorded. Ability to use directives:

   Scriptreplay yangrui.timing yangrui.session
will be able to see the operation like a movie, but not fast forward and backward (it may be that I did not find out, assuming who knows, can teach me). Personal advice to use:
Cat Yangrui.session

View the content. Assuming that the yangrui.session is opened in the graphical interface, the file will be filled with control characters and an ANSI escape sequence that looks as if it were garbled:


The solution can be found online. Personal suggestions can be viewed using 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 voluntarily separated by time.


A lot of other information about script and Scriptreplay can be queried using man script or man scriptreplay.

(tool Class) Linux notes terminal logging tool script

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.