Get the App
SLTechnology News&Howtos  ›  Development  › 

What is the use of the Linux tee command

Shulou Source: shulou.com Published: 2022-06-01 14:13:59 09月16日 Update

This article mainly introduces the use of the Linux tee command, the article is very detailed, has a certain reference value, interested friends must read it!

The tee command is used to redirect data to a file and, on the other hand, to provide a copy of the redirected data as a stdin for subsequent commands. To put it simply, redirect the data to a given file and screen.

1. Brief introduction to Command

After reading data from standard input, the tee command redirects the data to a given file and standard output. There can be multiple files for a given file.

Because tee means the letter T, data flows in from the left (standard input), shunts output from the right (standard output) and below (file), and the shape of the letter T vividly illustrates the flow direction of the data, so the command is named tee. The process of data flow is shown in the following figure.

Introduce the linux system tee command introduce the linux system tee command 2. Command format tee [OPTION]... [FILE]... 3. Option description-a,-- append

Use append mode when redirecting to a file

-I-- ignore-interrupts

Ignore interrupt (interrupt) signal

-- help

Display help information and exit

-- version

Display version information and exit

4. Common examples

(1) Standard error output and standard output are output to the screen and specified files file1 and file2 at the same time.

Make 2 > & 1 | tee file1 file2

2 > & 1 means to redirect the standard error output to standard output; tee means to output the command results to both the screen and the file.

The above is all the contents of the article "what is the use of Linux tee commands?" Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Tags: Commands outputs data files standards screens messages content simultaneously letters articles systems errors help input value signals interests copies on the other hand Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn Redmi Huawei Xiaomi Shulou Tech Info