|
In computing, tee is a command in various command line interpreters (shells) such as Unix shells, 4DOS/4NT and Windows PowerShell, which displays or pipes the output of a command and copies it into a file or a variable. It is primarily used in conjunction with pipes and filters.
Description and syntaxtee is normally used to split the output of a program so that it can be seen on the display and also be saved in a file. The command can also be used to capture intermediate output before the data is altered by another command or program. The tee command reads standard input, then writes its content to standard output and simultaneously copies it into the specified file(s) or variables. The syntax differs depending on the command's implementation: Unix-liketee [ -a ] [ -i ] [ File ... ] Arguments:
Flags:
The command returns the following exit values (exit status):
Note: If a write to any successfully opened File operand is not successful, writes to other successfully opened File operands and standard output will continue, but the exit value will be >0. 4DOS and 4NTTEE [/A] file... Arguments:
Flags:
Note: When tee is used with a pipe, the output of the previous command is written to a temporary file. When that command finishes, tee reads the temporary file, displays the output, and writes it to the file(s) given as command-line argument. Windows PowerShelltee [-FilePath] <String> [-InputObject <PSObject>] tee -Variable <String> [-InputObject <PSObject>] Arguments:
Note: tee is implemented as a ExamplesUnix-like
lint program.c | tee program.lint This displays the standard output of the command
lint program.c | tee -a program.lint This displays the standard output of the
echo "Body of file..." | sudo tee root_owned_file > /dev/null This example shows tee being used to bypass an inherent limitation in the sudo command. sudo is unable to pipe the standard output to a file. By dumping its stdout stream into 4DOS and 4NTThis example searches the file c:\> find "4DOS" wikipedia.txt | tee 4DOS.txt | sort > 4DOSsorted.txt Windows PowerShell
ipconfig | tee OutputFile.txt This displays the standard output of the command
gps | where { $_.Name -like "svc*" } | tee ABC.txt | where { $_.Handles -gt 1000 }
This example shows that the piped input for tee can be filtered and that tee is used to display that output, which is filtered again so that only processes owning more than 1000 handles are displayed, and writes the unfiltered output to the file See also
References
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
This article is from Wikipedia. All text is available under the terms of the GNU Free Documentation License.
Mercedes Car
This site monitored by SitePinger.net