您的位置:首页 > 其它

命令行操作记录工具

2016-12-27 22:13 246 查看
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秒

:~$ 

以上是完整的演示。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: