赞
踩
command|tee file
将command
输出在终端的同时输出到文件file中
command|tee file1 file2
将command
输出到终端的同时输出到文件file1
和file2
中
command|tee -a file
将command
输出到终端的同时追加到文件file
后
$ ll
total 0
-rw-r--r-- 1 root root 0 Dec 31 09:19 base1.txt
-rw-r--r-- 1 root root 0 Dec 31 09:19 base2.txt
-rw-r--r-- 1 root root 0 Dec 31 09:19 base3.txt
$ ll | tee ll.txt
$ cat -n ll.txt
1 total 0
2 -rw-r--r-- 1 root root 0 Dec 31 09:19 base1.txt
3 -rw-r--r-- 1 root root 0 Dec 31 09:19 base2.txt
4 -rw-r--r-- 1 root root 0 Dec 31 09:19 base3.txt
$ ll | tee ll1.txt ll2.txt同时输出到两个文件中
$ ll | tee -a ll.txt追加到文件中
$ tee --help
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
-i, --ignore-interrupts ignore interrupt signals
-p diagnose errors writing to non pipes
--output-error[=MODE] set behavior on write error. See MODE below
--help display this help and exit
--version output version information and
exit
https://www.gnu.org/software/coreutils/manual/html_node/tee-invocation.html#tee-invocation
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。