返回总目录页

tee命令详解

 

基础命令学习目录首页

 

参考:http://man.linuxde.net/tee

tee命令用于将数据重定向到文件,另一方面还可以提供一份重定向数据的副本作为后续命令的stdin。简单的说就是把数据重定向到给定文件和屏幕上。

存在缓存机制,每1024个字节将输出一次。若从管道接收输入数据,应该是缓冲区满,才将数据转存到指定的文件中。若文件内容不到1024个字节,则接收完从标准输入设备读入的数据后,将刷新一次缓冲区,并转存数据到指定文件。

[root@mayun /root/mcw] test!
#ls
a.txt  diff.txt  hostbuji.sh  mcwpaixu.txt  quanji.txt  te.txt  ziji.txt
[root@mayun /root/mcw] test!
#cat te.txt
a.txt
diff.txt
hostbuji.sh
mcwpaixu.txt
quanji.txt
ziji.txt
[root@mayun /root/mcw] test!
#
[root@mayun /root/mcw] test!
#cat a.txt
wo shi mcw, nihao
how do you do
魔降风云变
i want to go to school by bus.
[root@mayun /root/mcw] test!
#cat a.txt |tee te.txt
wo shi mcw, nihao
how do you do
魔降风云变
i want to go to school by bus.
[root@mayun /root/mcw] test!
#cat te.txt
wo shi mcw, nihao
how do you do
魔降风云变
i want to go to school by bus.

 

posted @ 2018-09-01 23:41  马昌伟  阅读(3431)  评论(0编辑  收藏  举报
博主链接地址:https://www.cnblogs.com/machangwei-8/