In Linux system, the use of tee command

Requirement description :

  Today, in the process of watching nginx content, I encountered the tee command, so I queried it and recorded the usage here.

Operation process :

1. Execute the following command

[root@testvm ~]# uname -n | tee hostInfo
testvm
[root@testvm ~]# cat hostInfo 
testvm

Note: Through the above execution, you can know that the tee command reads the content from the standard input, and then writes the read content to the standard output and the specified file. Therefore, the result of uname -n appears on the screen, in the file This information is also present.

 2. How to use the tee command

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.

Report tee bugs to bug-[email protected]
GNU coreutils home page: <http://www.gnu.org/software/coreutils/>
General help using GNU software: <http://www.gnu.org/gethelp/>
For complete documentation, run: info coreutils 'tee invocation'

 

Summary :

  The function of the tee command is to write the input content to the screen and file. The function of the input screen is to check whether the execution result of the previous command is what you want.

 

Document Creation Time: April 24, 2018 10:38:01

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324767602&siteId=291194637