码迷,mamicode.com
首页 > 其他好文 > 详细

tee命令

时间:2018-04-24 17:24:43      阅读:141      评论:0      收藏:0      [点我收藏+]

标签:tee命令

tee命令

tee命令可以把数据流同时重定向到文件和屏幕。


语法:

数据流  |  tee [选项]  [文件]


选项:

不加选项:覆盖重定向

-a:追加到文件


实例:

覆盖重定向。

[root@localhost ~]# head -n 2 /etc/passwd | cut -d ":" -f 1-3 | tee 1.txt

root:x:0

bin:x:1

[root@localhost ~]# cat 1.txt

root:x:0

bin:x:1

追加重定向。


[root@localhost ~]# head -n 2 /etc/passwd | cut -d ":" -f 1-3 | tee -a 1.txt

root:x:0

bin:x:1

[root@localhost ~]# cat 1.txt

root:x:0

bin:x:1

root:x:0

bin:x:1


tee命令

标签:tee命令

原文地址:http://blog.51cto.com/11060853/2107284

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!