tee命令-把数据重定向到给定文件和屏幕上
tee指令会从标准输入设备读取数据,将其内容输出到标准输出设备,同时保存成文件。
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
--help display this help and exit
--version output version information and exit
If a FILE is -, copy again to standard output.
如:ls | tee out.txt | cat -n
#将用户输入的数据同时保存到文件1和2
[root@db ~]# tee 1.txt 2.txt
dsdsadasd
dsdsadasd
sdasdasd
sdasdasd
^C
[root@db ~]# cat 1.txt
dsdsadasd
sdasdasd