Multiple Output Redirection
Sometimes you might prefer that the output from your command be placed in a file and be placed on stdout. The tee command provides this functionality. If you dwell on the name of the program—tee—you can almost visualize what the command does. Picture the output travelling up the vertical part of the letter “T”. When it reaches the top of the T, it splits the stream and the output goes in both directions (left and right). By default, the output will go to stdout and to the file whose name you specify at the end of the command syntax. The tee command can be used to redirect output to many places at once (not just two, as the name implies).
The following example directs the output of a ps command to files named xx and ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access