命令行操作记录工具

来源:互联网 发布:老滚捏脸数据 编辑:程序博客网 时间:2024/05/29 16:28

script工具可以记录shell回话。

在命令行输入“script”,系统将会提示"Script started,file is typesctript"。接下来随便输入几个命令,用户在命令行的操作会自动保存在typesctript文件中。

使用exit命令终止script会话。用"cat typescript"来显示之前记录的内容。

例如::~$ script
脚本已启动,文件为 typescript
:~$ ls -l /bin |head -5
总用量 11136
-rwxr-xr-x. 1 root root 1045704 6月  24  2016 bash
-rwxr-xr-x. 1 root root   34888 5月   4  2016 bunzip2
-rwxr-xr-x. 1 root root 1996936 8月  24 03:36 busybox
-rwxr-xr-x. 1 root root   34888 5月   4  2016 bzcat
:~$ exit
exit
脚本完成,文件为  typescript
:~$ cat typescript
脚本启动于 2016年12月27日 星期二 22时09分18秒
:~$ ls -l /bin |head -5
总用量 11136
-rwxr-xr-x. 1 root root 1045704 6月  24  2016 bash
-rwxr-xr-x. 1 root root   34888 5月   4  2016 bunzip2
-rwxr-xr-x. 1 root root 1996936 8月  24 03:36 busybox
-rwxr-xr-x. 1 root root   34888 5月   4  2016 bzcat
:~$ exit
exit


脚本完成,于 2016年12月27日 星期二 22时09分55秒
:~$ 

以上是完整的演示。

1 0