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
#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
#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.
#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.
#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.
#cat te.txt
wo shi mcw, nihao
how do you do
魔降风云变
i want to go to school by bus.