Previous view of their own historical operations, are history to view, only the command, sometimes the system returned nothing, read script can be recorded on their own operations, so they do a.
To log an operation before entering a command:
The command entered at this time has been recorded in the Test.txt file.
1[[Email protected] ~]# Cat Test.txt2[[Email protected] ~]# Cat Test.time3 0.658003 $4 0.008807 15 63.881151 16 0.270955 17 0.110210 18 0.160752 19 1.058148 6Ten 0.124927 1 One 1.307187 2 A 0.288081 2 - 0.511079 + - 0.008200 - the 0.000383 - - 4.558387 4 - 0.386289 4 - 0.184837 4 + 0.171161 4 - 0.211896 1 + 1.162147 1 A 0.122721 1 at 0.836252 3 - 0.102947 2
View Code
We can see that the contents of this two file are already in writing, if you want to stop the video, you can enter.
[Email protected] ~]# Exitexitscript done, file is Test.txt
This time to see the current directory there are two files, one is test.time another is Test.txt,test.time is recorded time data, Test.txt record is the operation record, of course, the names and paths of these two files, we can arbitrarily specify.
[Email protected] ~]# ls2 anaconda-ks.cfg a.sql install.log install.log.syslog test.time test.txt Wulaoer.sql
We cat below this file, you can see just the operation record.
[[Email protected] ~]# exitexitscript done on January 29, 2016 Friday 17:17 19 sec
Here's a note: the-t 2>test.time-t is the output of time data to standard error, so we use 2>test.time to turn the data into the Test.time file.
This is only visible, so how do we play this record?
Need to use Scriptreplay This command, the default system is not the command, how to install it? In fact, this script is a PL script that can be found in the Util-linux package. Be sure to install GCC before installation, if not installed at compile time must be error.
[Email protected] ~]# wget http://dxdown.onlinedown.net/down/util-linux-ng-2.17.2.tar.zip[[email protected] ~]# Unzip Util-linux-ng-2.17.2.tar.zip[[email protected] ~]# tar zxvf util-linux-ng-2.17.2.tar.gz[[email protected] ~]# CD Util-linux-ng-2.17.2[[email protected] util-linux-ng-2.17.2]#./configure--without-ncurses && make# Note: There is only one make[[email protected] util-linux-ng-2.17.2]# CP MISC-UTILS/SCRIPTREPLAY/USR/BIN/CP: Overwrite "/usr/bin/ Scriptreplay "? Y[[email protected] util-linux-ng-2.17.2]# CD. [Email protected] ~]# RM-RF util-linux-ng-2.17.2*
At this point, we can use the Scriptreplay command to play the video.
[Email protected] ~]# Scriptreplay test.time test.txt
Can play, but when we play, we should note that the two files "time file" and "command file" order do not reverse. With this, after doing a tutorial or something, after the video can be sent to two files, others can directly see, very convenient.
This article references: http://www.linuxyan.com/web-server/28.html
Use script and Scriptreplay to manipulate video on command line under Linux