QuestionQ47

Essential Commands

Which command below sends output from the myapp program to both standard output (stdout) and the file1.log file?

  • A cat < myapp | cat > file1.log
  • B myapp 0>&1 | cat > file1.log
  • C myapp | cat > file1.log
  • D myapp | tee file1.log
  • E tee myapp file1.log
Explanation

The tee utility copies data received on standard input to both standard output and each named file. Thus, piping myapp into tee file1.log displays the program output and writes the same output to file1.log.

Community Discussion

No comments yet. Be the first to start the discussion!