LINUX终端记录神器
1、输入 script 命令,当前目录自动创建typescript文本文件,记录此终端后续操作。ctrl + D或exit,退出记录
[root@localhost ~]# script
Script started, file is typescript
[root@localhost ~]# ehco hello HJ
bash: ehco: 未找到命令…
相似命令是: ‘echo’
[root@localhost ~]# echo Hello HJ
Hello HJ
[root@localhost ~]# exit
exit
Script done, file is typescript
2、指定目录或创建指定名字的文件
[root@localhost ~]# script /home/record2020109.log
Script started, file is /home/record2020109.log
[root@localhost ~]# echo Hello World
Hello World
[root@localhost ~]# exit
Script done, file is /home/record2020109.log
3、继续记录:script -a filename
[root@localhost ~]# script -a cooperate-job
Script started, file is cooperate-job
[root@localhost ~]# echo this is harry_s job
this is harry_s job
[root@localhost ~]# pwd
/home/alvin/test
[root@localhost ~]# exit
exit
Script done, file is cooperate-job
4、打开终端自动记录
将 script 命令添加到 Shell 配置文件中,用户登录,script 命令就自动启动
修改 .bash_profile 文件。
vim ~/.bash_profile
添加script 命令
/usr/bin/script -qa path/filename #-q 代表静默记录
Source一下