101-500 Exam QuestionsBrowse all questions from this exam

101-500 Exam - Question 47


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?

Show Answer
Correct Answer: D

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.

Discussion

4 comments
Sign in to comment
CuriousLinuxCatOption: D
Jul 24, 2021

D is correct. Keyword is 'tee'. Think of the letter 'T' where it sends information two-ways!

rockk18
Jul 1, 2022

you saved me by your explanation in letter T, thank you.

mentor84Option: D
May 10, 2020

cat foo | tee /tmp/foodata

lanc
May 27, 2020

foo is considered as a command. (as the question says the output of the command)

M_ukesh8Option: D
Aug 14, 2023

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 (|)

NinymoOption: D
Mar 24, 2024

Answer: D