1. 首页
  2. IT资讯

rhel5_script自动记录操作命令历史序列

-bash-3.2$ script. mylove.txt  #开启记录功能,把所有的输入的命令存储在mylove.txt
Script. started, file is mylove.txt
bash-3.2$ command1
bash: command1: command not found
bash-3.2$ command2
bash: command2: command not found
bash-3.2$ three
bash: three: command not found
bash-3.2$ commdn
bash: commdn: command not found
bash-3.2$ commdn
bash: commdn: command not found
bash-3.2$ last
root     pts/0        192.168.19.168   Mon Jun 21 19:19   still logged in  
root     pts/0        192.168.19.168   Mon Jun 21 13:28 – 19:19  (05:50)   
root     pts/0        192.168.19.168   Mon Jun 21 10:43 – 11:40  (00:56)   
reboot   system boot  2.6.18-128.el5   Mon Jun 21 10:41          (08:45)   
root     pts/2        192.168.19.168   Fri Jun 18 11:30 – down   (06:29)   
root     pts/1        192.168.19.160   Fri Jun 18 11:23 – 13:36  (02:12)   
root     pts/1        192.168.19.160   Fri Jun 18 11:22 – 11:22  (00:00)   
root     pts/1        192.168.19.160   Fri Jun 18 11:22 – 11:22  (00:00)   
root     pts/0        192.168.19.168   Fri Jun 18 09:41 – 11:46  (02:05)   
reboot   system boot  2.6.18-128.el5   Fri Jun 18 08:28          (09:31)   
root     pts/1        192.168.19.168   Thu Jun 17 16:47 – crash  (15:40)   
root     pts/1        192.168.19.168   Thu Jun 17 16:47 – 16:47  (00:00)   
root     pts/1        192.168.19.168   Thu Jun 17 16:47 – 16:47  (00:00)   
root     pts/1        192.168.19.168   Thu Jun 17 16:47 – 16:47  (00:00)   
root     pts/1        192.168.19.168   Thu Jun 17 16:39 – 16:47  (00:07)   
root     pts/0        192.168.19.168   Thu Jun 17 13:37 – crash  (18:50)   
reboot   system boot  2.6.18-128.el5   Thu Jun 17 13:36         (1+04:22)  
root     tty1                          Thu Jun 17 11:12 – down   (00:00)   
root     pts/0        192.168.19.168   Thu Jun 17 09:39 – down   (01:33)   
reboot   system boot  2.6.18-128.el5   Thu Jun 17 09:39          (01:33)   
root     pts/0        192.168.19.168   Thu Jun 17 09:31 – down   (00:06)   
reboot   system boot  2.6.18-128.el5   Thu Jun 17 09:30          (00:07)   
root     pts/1        192.168.19.168   Thu Jun 17 09:21 – down   (00:07)   
root     pts/0        192.168.19.168   Thu Jun 17 08:47 – down   (00:41)   
reboot   system boot  2.6.18-128.el5   Thu Jun 17 08:30          (00:58)   
root     pts/1        192.168.19.160   Sun Jun 13 17:40 – 17:40  (00:00)   
root     pts/1        192.168.19.160   Sun Jun 13 15:09 – 16:55  (01:45)   
root     pts/0        192.168.19.168   Sun Jun 13 14:55 – down   (02:46)   
root     pts/1        192.168.19.168   Sun Jun 13 11:48 – 14:40  (02:51)   
root     pts/2        192.168.19.160   Sun Jun 13 08:56 – 09:54  (00:57)   
root     pts/1        192.168.19.168   Sun Jun 13 08:27 – 09:54  (01:26)   
root     pts/0        192.168.19.168   Sun Jun 13 08:23 – 14:40  (06:16)   
root     pts/2        192.168.19.168   Sat Jun 12 18:05 – 21:58  (03:52)   
root     pts/1        192.168.19.168   Sat Jun 12 16:48 – 21:58  (05:09)   
root     pts/0        192.168.19.168   Sat Jun 12 16:45 – 21:58  (05:12)   
root     pts/0        192.168.19.168   Sat Jun 12 16:08 – 16:45  (00:37)   
root     tty1                          Sat Jun 12 13:45 – down  (1+03:55)  
root     tty1                          Sat Jun 12 13:33 – 13:35  (00:02)   
root     tty1                          Sat Jun 12 13:18 – 13:19  (00:00)   
reboot   system boot  2.6.18-128.el5   Sat Jun 12 13:18         (1+04:23)  
root     tty1                          Sat Jun 12 13:14 – down   (00:02)   
reboot   system boot  2.6.18-128.el5   Sat Jun 12 13:12          (00:04)   
root     tty1                          Sat Jun 12 12:56 – down   (00:15)   
reboot   system boot  2.6.18-128.el5   Sat Jun 12 12:49          (00:22)   
wtmp begins Sat Jun 12 12:49:22 2010
bash-3.2$ exit  #退出script命令记录
exit
Script. done, file is mylove.txt
-bash-3.2$
 
 
以后工作,除了secure crt外,多了一种选择了,有空再学习下如何回放这些记录的命令文件

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/9240380/viewspace-665813/,如需转载,请注明出处,否则将追究法律责任。

主题测试文章,只做测试使用。发布者:℅傍ㄖ免沦陷dε鬼,转转请注明出处:http://www.cxybcw.com/192824.html

联系我们

13687733322

在线咨询:点击这里给我发消息

邮件:1877088071@qq.com

工作时间:周一至周五,9:30-18:30,节假日休息

QR code