Linux Terminal recording screen and play script command

Source: Internet
Author: User

Sometimes you may want to record all the operations on the terminal including output, etc., in the future as video playback. The system administrator may need to log some user actions. In addition, it may sometimes be necessary to demonstrate some operational processes to people in real time. These can all be done through script.

Script Introduction

The script command is used to save the terminal session. Use the following

usage:script [Options] [file]options:-A,--Append append the output-C,--command <command>Run command rather than interactive shell-R,--return return exit code of the child process-F,--flush run flush after eachWrite--force Use outputfileeven when it was a link-Q,--quiet Be quiet-T,--timing[=<file>] Output timing data to stderr (or to FILE)-V,--version output version information and exit-H,--help display this help and exit

Commonly used to have

-a specifies that the output is attached to a file and is not overwritten so that the same file can be used all the time

-T is used to output time information, which is used when playing back

-Q does not display the script start and exit commands so that the user can not fully notice the recording screen

-F refreshes the cache immediately after each operation. If this option is not set, the file is not written in real time.

Usage Example Records

Prompts the script to start and logs to the specified file. If the file already exists, you want to append the record, plus the-a option

Use CTRL + D to exit the record with the latter exit

If you want to output the time file simultaneously

Script-t timingfile-a ScriptFile
Playback

Need to scriptreplay this command.

Scriptreply Timingfile ScriptFile

The effect is almost as much as video recording.

Automatic recording of user activity

Can be added in the user's. Profile

/USR/BIN/SCRIPT-QA  LogFile

The next time the user logs in, the script will automatically be saved to logfile

-Q is to not display the hint text "script started ..." so that the user is completely unaware of the existence of the script.

Broadcast your own terminal operations to multiple users

Operation this itself establishes a FIFO file in the terminal (about FIFO and Mkfifo, which can be searched by dogs), for communication

$ Mkfifo Path/testfifo

Many other users view this file

Cat Path/testfifo

The operator begins to record his actions in script and saves them to testfifo in real time.

Script-f Path/testfifo

Remember the first-F effect, right? Let script write to file in real time

This way, other users can see the demo of the operator.

Linux Terminal recording screen and play script command

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.