Linux recording, playback, and sharing terminal operations

Source: Internet
Author: User

Use the script command to record and play the recorded action using Scriptreplay. The operation of the shared terminal requires the use of a named pipe to implement.

1.1 Recording
[[Email protected] ~]# CD/2> Timing.log-a output.session  is Output.session
[[email protected] tmp]# LS                 # Perform an action: command lsabc.sh  ab.sh  index.html    lost +found Output.session  scriptfifo  test  test1  timing.log  vmware-/tmp/test      # Do one More action: command CD
[[email protected] test]# exit    is output.session

where "-T 2> Timing.log" is the necessary option to play back, without "2>" will cause any input after the recording is garbled state, without "-t Timing.log" will not be able to use scriptreplay back and forth. Timing.log records How many characters are entered for each time period. Playback can be achieved with Timing.log and output.session mates.

Note that it is important to ensure that timing.log and output.session are empty files before recording, otherwise it will result in inconsistent operation during playback.

1.2 Playback
[Email protected] test]# Scriptreplay timing.log output.session
1.3 Terminal screen sharing

The implementation of the information is transmitted through pipelines. Need a pipe file and open the pipe file at the terminal that needs to be shown.

Use Mkfifo to create a pipeline file on Terminal 1 (as the primary terminal, which is the terminal for the demo operation).

Mkfifo Scriptfifo[[email protected] tmp]# ll SCRIPTFIFOPRW 1 0  - page: scriptfifo   # The first p in front of the permission bit represents the pipe file.

Open the pipe file on Terminal 2.

Cat /tmp/scriptfifo

Use Script-f on Terminal 1 to start recording operations, and subsequent operations will be shared on Terminal 2.

[Email protected] tmp]# script-f Scriptfifo

Use Exit to stop sharing and exit recording behavior.

 Done file is Scriptfifo

You will not be able to perform any actions after participating in the sharing status on the shared terminal, and the actions performed will be recorded and executed automatically when the primary terminal stops sharing.

Back to series article outline:http://www.cnblogs.com/f-ck-need-u/p/7048359.html

Reprint Please specify source:http://www.cnblogs.com/f-ck-need-u/p/7429520.html Note: If you think this article is not bad please click on the lower right corner of the recommendation, with your support to inspire the author more enthusiasm for writing, thank you very much!

Linux recording, playback, and sharing terminal operations

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.