Home > Operation and Maintenance > Linux Operation and Maintenance > Detailed explanation of Linux tee command

Detailed explanation of Linux tee command

藏色散人
Release: 2023-03-13 09:16:53
Original
2795 people have browsed it

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.

Detailed explanation of Linux tee command

#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 errors

warn-nopipe Diagnosis when writing to non-pipeline encounters an error

exit Exit when writing to non-pipeline encounters an error

exit-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.
Copy after login

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 content
Copy after login
Related 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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template