Linux and Unix tee command
Quick links
About tee
Syntax
Examples
Related commands
Linux and Unix main page
About tee
Read from an input and write to a standard output and file.
Syntax
tee [OPTION]... [FILE]...
-a
--append Append to the given FILEs, do not overwrite.
-i ignore interrupt signals.
--help Display the help screen.
--version Display the version.
Examples
ls *.txt | wc -l | tee /dev/tty count.txt
In the above example the ls command would list all .txt files in the current directory, take a word count (wc) by the amount of lines (-l) and the output displayed to the /dev/tty (terminal) will be sent to the count.txt.
Note: Because the above example did not take advantage of the -a or append option if the count.txt file already existed it would have been overwritten.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment