Which of the following commands displays the output of the foo command on the screen and also writes it to a file called /tmp/foodata?
Which of the following commands displays the output of the foo command on the screen and also writes it to a file called /tmp/foodata?
The 'tee' command is used to read from standard input and write to standard output and files simultaneously. In this context, the command 'foo | tee /tmp/foodata' will execute 'foo', display its output on the screen, and also write that output to the file '/tmp/foodata'. None of the other options correctly perform both actions.
D is correct. Keyword is 'tee'. Think of the letter 'T' where it sends information two-ways!
you saved me by your explanation in letter T, thank you.
cat foo | tee /tmp/foodata
foo is considered as a command. (as the question says the output of the command)
tee command generally gives std. output to screen and at the same time output can be append to file with -a flag. Condition: It needs a standard input via (|)
Answer: D