script
is a very cool command, it can be all the operation of the terminal and input and output recorded, and through scriptreplay
playback, is the command line version "屏幕录像专家"
. Very useful, for example, you want to teach a lot of people to configure a software, you can configure the process to record, and then send others self-taught, gray elegant!
One. Installation
Most operating systems are installed by default Redhat/Fedora/CentOS
:
Host: Bj_web_ip:252.97 User: Root Dir:~$ >>Yum Install Util-linux-ng
Or
Host: Bj_web_ip:252.97 User: Root Dir:~$ >>rpm-vih/mnt/Packages/util-linux-ng-2.17.2-12.24. el6.x86_64.rpm
Second, recording and playback
host :bj_web_ip : 252.97 user :root dir :~ $ >> script-t-a 2 > /tmp/time . Txt/tmp/record.txt
ctrl+d or exit
End recording
simply say the parameters of the command:
-t
is to output the time data to standard error, so to use 2>/tmp/time.txt to redirect the data to the file, in some cases do not need to replay, as long as the record operation and input and output, you can not specify this parameter
-a
Append content to file, not overwrite previous record
-q
Quiet mode, does not prompt the user script to run
-f
Clear screen after each write, useful when used with piping
-c
These non-interactive run commands or scripts are useful when some programs or scripts are running in the background
2.2 Plays
host :bj_web_ip : 252.97 user :root dir :~ $ >> scriptreplay/tmp/time.txt/tmp/record.txt
650) this.width=650; "src=" Http://s4.51cto.com/wyfs02/M02/86/29/wKiom1e2iR-Q3rj1AAO1yLlxw3E650.gif "title=" Gif.gif "alt=" Wkiom1e2ir-q3rj1aao1yllxw3e650.gif "/>
2.3 Logging User Actions
Record a user and include in the user's ~/.profile file:
host :bj_web_ip : 252.97 user :root dir :~ $ >> /usr/bin/script-qa/tmp/user_record
Log all user actions and add the above content to the/etc/profile file. Record user operation output will be more, playback is very time-consuming, so usually do not record time
2.4 Live broadcast operations
1, broadcast their own operations to other users on the server to see, you need to create a pipeline first:
host :bj_web_ip : 252.97 user :root dir :~ $ >> mkfifo/tmp/fifo
2, SCRITP output to pipeline:
host :bj_web_ip : 252.97 user :root dir :~ $ >> script-f/tmp/fifo
3, other users execute:
host :bj_web_ip : 252.97 user :root dir :~ $ >> cat/tmp/fifo
4, you can view the operation and input and output in real time (other users can only view or exit exit, unable to operate the command)
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M02/86/29/wKioL1e2itfwUpISAAHz6p_nbKs971.gif "title=" Gif2.gif "alt=" Wkiol1e2itfwupisaahz6p_nbks971.gif "/>
This article from "Live by the Sea like Waves" blog, please be sure to keep this source http://zhang789.blog.51cto.com/11045979/1840257
Linux Terminal recording screen and play script command