当前位置:   article > 正文

Linux——tee命令终端输出到文件_diagnose errors writing to non pipes

diagnose errors writing to non pipes

常用tee命令

command|tee filecommand输出在终端的同时输出到文件file中
command|tee file1 file2command输出到终端的同时输出到文件file1file2
command|tee -a filecommand输出到终端的同时追加到文件file

tee命令实战

$ 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追加到文件中
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13

tee --help

$ 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
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11

tee GNU解释

https://www.gnu.org/software/coreutils/manual/html_node/tee-invocation.html#tee-invocation
  • 1
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/AllinToyou/article/detail/578274
推荐阅读
相关标签
  

闽ICP备14008679号