PrepAway - Latest Free Exam Questions & Answers

Which of the following commands is used to append the list of files in the /tmp directory to an existing file

Which of the following commands is used to append the list of files in the /tmp directory to an
existing file named deletelater.txt?

PrepAway - Latest Free Exam Questions & Answers

A.
ls /tmp > deletelater.txt

B.
ls deletelater.txt /tmp

C.
ls /tmp deletelater.txt

D.
ls /tmp >> deletelater.txt

Explanation:

The ls command is used to list files on a Linux computer. The syntax of the ls command is as
follows:
ls [option] [directory name]
Several options are used with the ls command. Following is a list of some important options:

For example, the following command displays all the files (including hidden files) in the /home
directory and the contents in the subdirectories:
What is >> command?
The >> command is used for storing the output generated by different commands. It creates a file
specified to store the output. If the specified file already exists, it appends that file.
Answer option A is incorrect. The > command is used for storing the output generated by different
commands. It creates a file specified to store the output. If the specified file already exists, it
overwrites that file.
Answer options C and B are incorrect. Improper syntax has been followed in these answer
options.


Leave a Reply