Usage: tee [OPTION]... [FILE]...
Copy standard input to each FILE, and also to standard output.
-a, --append append to the given FILEs, do not overwrite
![](http://hi.csdn.net/attachment/201108/3/0_1312350040L3i0.gif)
tee 是将命令结果同时输出到屏幕和文件, 一般和管道结合使用。
如果使用 -a 选项,就是追加数据到文件中。否则,就是覆盖文件。
Copy standard input to each FILE, and also to standard output.
-a, --append append to the given FILEs, do not overwrite
![](http://hi.csdn.net/attachment/201108/3/0_1312350040L3i0.gif)
tee 是将命令结果同时输出到屏幕和文件, 一般和管道结合使用。
如果使用 -a 选项,就是追加数据到文件中。否则,就是覆盖文件。
hello.c
Makefile
$ cat output.txt
hello.c
Makefile
$ cal | tee output.txt
August 2011
Su Mo Tu We Th Fr Sa
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31
$ cat output.txt
August 2011
Su Mo Tu We Th Fr Sa
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31
$ ls | tee -a output.txt
hello.c
Makefile
output.txt
$ cat output.txt
August 2011
Su Mo Tu We Th Fr Sa
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31
hello.c
Makefile
output.txt