LX0-103 · Question #193
For which of the following can the tee command be used?
The correct answer is E. Send a command's output to stdout and a to file at the same time.. The tee command reads from stdin and writes simultaneously to stdout and one or more files, making it useful for logging output while still displaying it on screen.
Question
For which of the following can the tee command be used?
Options
- APrint the contents of a file in reverse order.
- BUse the output of one command as arguments to another.
- CAdd line numbers to the output of a command.
- DPipe the output of one command into the input of another.
- ESend a command's output to stdout and a to file at the same time.
How the community answered
(23 responses)- A9% (2)
- C4% (1)
- E87% (20)
Why each option
The tee command reads from stdin and writes simultaneously to stdout and one or more files, making it useful for logging output while still displaying it on screen.
Reversing file content is done by the tac command, not tee.
Using output of one command as arguments to another is the function of xargs, not tee.
Adding line numbers to output is done with nl or cat -n, not tee.
Piping output from one command into the input of another is performed by the shell pipe operator '|', not tee.
The tee command is named after a T-shaped pipe fitting because it splits output in two directions at once. It reads from standard input and writes the data to both standard output and to one or more files simultaneously, allowing a pipeline to continue while also capturing output to a file.
Concept tested: Linux tee command stdout and file redirection
Source: https://www.gnu.org/software/coreutils/manual/html_node/tee-invocation.html
Topics
Community Discussion
No community discussion yet for this question.