Multiple choice technology operating systems

How to save the output of any command in a file as well as display the same on the VDU?

  1. echo “hello world” > temp.txt

  2. echo “hello world” | tee temp.txt

  3. echo "hello world">tmp.txt|tee tmp.txt

  4. echo "hello world">tmp.txt|print

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

The tee command reads from stdin and writes to both stdout and a file. echo 'hello world' | tee temp.txt displays on screen AND saves to temp.txt. Single > only redirects to file, no display.