Which of the following commands is used to save the output of the who command in a file named user.lst, as well as display it? A. who | tee user.lst B. who > user.lst C. who >> user.lst D. who < user.lste E. None of the above

[amp_mcq option1=”who | tee user.lst” option2=”who > user.lst” option3=”who >> user.lst” option4=”who < user.lste E. None of the above" correct="option1"]

The correct answer is A. who | tee user.lst.

The who command lists all users currently logged in to a system. The tee command writes its standard input to both a file and to standard output. In this case, the who command’s output is piped to the tee command, which writes it to the file user.lst and also displays it on the screen.

The > operator redirects standard output to a file. In this case, the who command’s output would be written to the file user.lst and would not be displayed on the screen.

The >> operator redirects standard output to a file, appending the output to the file if it already exists. In this case, the who command’s output would be appended to the file user.lst if it already exists, and would be written to the file if it does not exist.

The < operator redirects standard input from a file. In this case, the who command would read its input from the file user.lst.

E is not a valid command.

Exit mobile version