linux终端日志文件,Linux教程 怎么记录linux终端下的操作日志

在linux终端下,为方便检查操作中可能出现的错误,以及避免屏幕滚屏的限制,我们可以把操作日志记录下来。常用的工具有 screen,script,以及tee等。 1. screen — screen manager with VT100/ANSI terminal emulatio screen -L 这里是我们的操作 exit 结束后会生成一个类似这样的文件名: screenlog.0 more screenlog.0 这样可以查看你刚才进行的操作,发现可能存在的问题 2. script — make typescript of terminal session script 我们的操作 exit 生成一个这样的文件:typescript more typescript 这里查看我们进行的操作 3. tee – read from standard input and write to standard output and files 这个命令可以读取终端输入输出到终端或者文件中,有时候可以用来记录make等命令可能产生的输出到终端的大量内容输出到文件中去。这样可以方便记 录这些命令的日志。 make 2&1 | tee make.log 当然,我们也可以直接重定向到一个文件中 make make.log PS: 2&1是为了记录错误日志 if you want to filter the control symbols, try to use the "col" command like this: $ cat screenlog.0 | col -b screenlog or $ cat typescript | col -b scriptlog 还有一个比较好用的命令tail -f 比如把输出定向到text ./run.shtext tail -f text 这个命令会follow输出定向文件的内容

取消

评论

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值