shell中的tee命令的使用
2015-11-14 21:03
453 查看
tee命令作用可以用字母T来形象地表示。它把输出的一个副本输送到标准输出,另一个副本拷贝到相应的文件中。如果希望在看到输出的同时,也将其存入一个文件,那么这个命令再合适不过了。它的一般形式为:
tee -a files
其中,- a表示追加到文件末尾。
当执行某些命令或脚本时,如果希望把输出保存下来,tee命令非常方便。
下面我们来看一个例子,我们使用w h o命令,结果输出到屏幕上,同时保存在who.out文件中:
[tang@Server shell]$ who | tee -a who.out
root tty1 2015-11-14 22:55
tang pts/0 2015-11-14 23:50 (192.168.1.105)
[tang@Server shell]$ ll
-rw-rw-r--. 1 tang tang 94 11月 15 04:30 who.out
tee -a files
其中,- a表示追加到文件末尾。
当执行某些命令或脚本时,如果希望把输出保存下来,tee命令非常方便。
下面我们来看一个例子,我们使用w h o命令,结果输出到屏幕上,同时保存在who.out文件中:
[tang@Server shell]$ who | tee -a who.out
root tty1 2015-11-14 22:55
tang pts/0 2015-11-14 23:50 (192.168.1.105)
[tang@Server shell]$ ll
-rw-rw-r--. 1 tang tang 94 11月 15 04:30 who.out
相关文章推荐
- Linux socket 初步
- android wifi 无线调试
- linux lsof详解
- linux 文件权限
- Linux 执行数学运算
- 10 篇对初学者和专家都有用的 Linux 命令教程
- Linux 与 Windows 对UNICODE 的处理方式
- Ubuntu12.04下QQ完美走起啊!走起啊!有木有啊!
- 解決Linux下Android开发真机调试设备不被识别问题
- 运维入门
- 运维提升
- Linux 自检和 SystemTap
- 动态清空 nohup 输出文件
- install scrapy with pip and easy_install
- Ubuntu Linux使用体验
- c语言实现hashmap(转载)
- Linux 信号signal处理机制
- linux下mysql添加用户