» Linux » Examen sur Linux » Examen 201 : Advanced Administration » Section 5 » Question 11/23
11.In order to create a file called DirContents containing the contents of the /etc directory you would type _______.
Answer: ls /etc >DirContents

Explanation: Mostly all commands send their output to the screen or take input from the keyboard, but in Linux it is possible to send output to a file or to read input from a file. For example, the ls command sends it's output to screen; to send the output to a file, you can use the command ls > filename. This will send the output of the ls command to filename. In this question, the ls command lists the contents of the /etc directory and sends the list to a file named DirContents.

Reference: http://www.netti.hu/doc/LinuxShellScript/rpf.htm

« Question 10 Question 12 »