Linux终端里的记录工具
如果要退出记录,可以在终端里按快捷键 ctrl + D 或直接输入 exit 。在退出 script 前,你会发现,记录文件大小为 0 Kb,当退出后,文件大小会变大。 [alvin@VM_0_16_centos test]$ script Script started, file is typescript [alvin@VM_0_16_centos test]$ echo hello hello [alvin@VM_0_16_centos test]$ ls test1.py test2 test2.cpp test2.py test3 test3.c test.py typescript WeixinBot wxpy wxRobot [alvin@VM_0_16_centos test]$ exit exit Script done, file is typescript 如果我们想要自己起个文件名,或者将文件放在其它位置,那么我们可以直接在 script 后面跟上文件名即可。 [alvin@VM_0_16_centos test]$ script ~/alvin-script Script started, file is /home/alvin/alvin-script [alvin@VM_0_16_centos test]$ ll total 64 -rw-rw-r-- 1 alvin alvin 21 Nov 10 09:40 test1.py -rwxrwxr-x 1 alvin alvin 14074 Dec 31 07:35 test2 -rw-rw-r-- 1 alvin alvin 403 Dec 31 07:35 test2.cpp -rw-rw-r-- 1 alvin alvin 2093 Nov 10 10:50 test2.py -rwxrwxr-x 1 alvin alvin 8553 Jan 7 20:03 test3 -rw-rw-r-- 1 alvin alvin 78 Jan 7 20:03 test3.c -rw-rw-r-- 1 alvin alvin 94 Nov 9 23:25 test.py -rw-rw-r-- 1 alvin alvin 489 Jan 11 12:07 typescript drwxrwxr-x 6 alvin alvin 4096 Nov 10 11:19 WeixinBot drwxrwxr-x 6 alvin alvin 4096 Nov 10 11:30 wxpy drwxrwxr-x 11 alvin alvin 4096 Nov 10 11:34 wxRobot [alvin@VM_0_16_centos test]$ echo hello hello [alvin@VM_0_16_centos test]$ exit exit Script done, file is /home/alvin/alvin-script 学会这两个基本操作,可以应付很多场景下需要记录终端的场景。 如何使用 script 与同事协作? 现在有一项工作,需要与同事一起协作,我完成一半,他完成另一半。 首先,我来做我的工作,用 script 记录一下我的工作过程: [alvin@VM_0_16_centos test]$ script cooperate-job Script started, file is cooperate-job [alvin@VM_0_16_centos test]$ echo this is alvin_s job this is alvin_s job [alvin@VM_0_16_centos test]$ ls cooperate-job test1.py test2 test2.cpp test2.py test3 test3.c test.py typescript WeixinBot wxpy wxRobot [alvin@VM_0_16_centos test]$ exit exit Script done, file is cooperate-job 工作完成之后,将记录文件发给同事,他可以使用文本工具打开,就可以知道你的进度了,然后接着你的进度干活。 如果他要接着在你的记录文件里记录他的操作的话,可以加一个 -a 选项,即 append 的缩写。 (编辑:航空爱好网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |