Home > Article > Operation and Maintenance > Detailed explanation of Linux tee command
The function of the Linux tee command is to read from the standard input and then write to the standard output and files. Its usage syntax is "tee [OPTION]... [FILE]...", where the parameter "- a --append" means appending to the file, the parameter "-i --ignore-interrupts" means ignoring interrupt signals, and the parameter "-p" means diagnosing errors in writing to non-pipelines, etc.
#The operating environment of this tutorial: linux5.9.8 system, Dell G3 computer.
linux command: tee detailed explanation
The function of tee is to read from standard input and then write to standard output and files.
Usage: tee [OPTION]... [FILE]...
-a, --append Append to the file
-i, -- ignore-interrupts Ignore interrupt signals
-p
--help . Diagnosis when writing encounters errorswarn-nopipe Diagnosis when writing to non-pipeline encounters an errorexit Exit when writing to non-pipeline encounters an errorexit-nopipe Exit when writing to non-pipeline encounters an error
If --output-error is not specified, tee will exit immediately when an error occurs when writing to a pipe, and diagnose when writing to a non-pipeline.
Usage example:
Default function and append function:
[root@server dir]# echo 'This is a sentence.' | tee output This is a sentence. [root@server dir]# cat output This is a sentence. [root@server dir]# echo 'This is another sentence.' | tee -a output This is another sentence. [root@server dir]# cat output This is a sentence. This is another sentence. [root@server dir]# echo 'This is a unique sentence.' | tee output This is a unique sentence. [root@server dir]# cat output This is a unique sentence.Write two files at the same time:
[root@server dir]# tee a b they have the same content they have the same content ^C [root@server dir]# cat a they have the same content [root@server dir]# cat b they have the same contentRelated recommendations: "Linux Video Tutorial
"
The above is the detailed content of Detailed explanation of Linux tee command. For more information, please follow other related articles on the PHP Chinese website!