Linux terminal screen recording and script playback commands, linux screen recording

Source: Internet
Author: User

Linux terminal screen recording and script playback commands, linux screen recording

Sometimes you may want to record all operations on the terminal, including the output, and play the video in the future. The system administrator may need to record the operations of some users. In addition, you may need to demonstrate some operation procedures in real time. These functions can be implemented through scripts.

Script Introduction

The script command is used to save the terminal session. Usage:

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 each write     --force             use output file even when it is 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

-A specifies that the output is appended to a file and will not be overwritten, so that the same file can be used all the time.

-T is used to output time information, which is used for playback.

-Q does not display the script startup and exit commands, so that the user can be completely unaware of the screen recording.

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

Usage example record

Prompt script to start and record it to the specified file. If this file already exists, you want to append the record with the-a option.

Use Ctrl + D and exit to exit the record

If you want to output time files at the same time

script -t timingfile -a scriptfile
Playback

The scriptreplay command is required.

scriptreply timingfile scriptfile

The effect is similar to that of video recording.

Automatically record user activities

You can add

/usr/bin/script -qa  logfile

The script is automatically saved to the logfile next time you log on.

-Q is used not to display prompt text such as "Script started...", so that the user cannot fully detect the existence of the script.

Broadcast terminal operations to multiple users

The operation itself creates a fifo file in the terminal (for fifo and mkfifo, you can search for it by dog) for communication.

$ mkfifo PATH/testfifo

Multiple other users can view this file.

$ cat PATH/testfifo

The operator starts to use scripts to record his operations and saves them to testfifo in real time.

script -f PATH/testfifo

Remember the role of-f in the beginning? Real-time writing of scripts to files

In this way, other users can see the operator's demo.

 

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.