Lpic 1 Linux Administrator · Free Practice Question Easy
Question 20
- A A new file named files is created, which then contains the output of the ls command.
- B The output of ls is displayed on the terminal.
- C An error message is displayed, and the ls command does not execute.
- D The command named files is executed and it receives the output of the ls command.
- E The output of ls is ignored and not saved or displayed.
Reveal correct answer
Correct answer: A
A.
Correct. The > operator redirects the output of the ls command to the file files. If files does not exist, it is created. The output of ls is saved to this file.
B.
Incorrect. The > operator redirects the output to a file, so it will not be displayed on the terminal.
C.
Incorrect. No error occurs if the file does not exist; it will simply be created, and ls output will be redirected to it.
D.
Incorrect. files is not executed as a command; instead, it is created as a file to store the output of ls.
E.
Incorrect. The > operator ensures that the output is saved to the specified file (files), not ignored.
Discussion
Think the marked answer is wrong, or have a better explanation? Share it below — comments appear after review.
