您的位置:首页 > 其它

tee 命令用法

2011-08-03 13:54 218 查看
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



tee 是将命令结果同时输出到屏幕和文件,一般和管道结合使用。

如果使用 -a 选项,就是追加数据到文件中。否则,就是覆盖文件。

$ ls | tee output.txt

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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: