首页 > 其他 > 详细

centos的tee命令

时间:2019-08-18 01:18:17      阅读:196      评论:0      收藏:0      [点我收藏+]

Linux tee命令用于读取标准输入的数据,并将其内容输出成文件。

tee默认覆盖源文件  tee -a不覆盖

[root@centos7 2019-08-17]# echo "1"|tee test.txt
1
[root@centos7 2019-08-17]# cat test.txt
1
[root@centos7 2019-08-17]# echo "2"|tee test.txt
2
[root@centos7 2019-08-17]# cat test.txt
2
[root@centos7 2019-08-17]# echo "3"|tee -a test.txt
3
[root@centos7 2019-08-17]# cat test.txt
2
3

 

应用场景

1:

记录文件名并且显示具体数量
ls *.html|tee output.txt |wc -l

 

2:

记录ping包

ping -c4  baidu.com |tee -a test.txt

 

3:

追加多个文件
ping baidu.com | tee output1.txt output2.txt output3.txt

centos的tee命令

原文:https://www.cnblogs.com/daixubinbin/p/11370843.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!