Exercise 1

Question 16 :

Which of the following commands will show a list of the files in your home directory including hidden files and the contents of all subdirectories? Choose one:


A). ls -c home
B). ls -aR /home/username
C). ls -aF /home/username
D). ls -l /home/username
Answer : Option B

Explanation :

The ls command is used to display a listing of files. The -a option will cause hidden files to be displayed as well. The -R option causes ls to recurse down the directory tree. All of this starts at your home directory.


Question 17 :

You have a directory called /home/ben/memos and want to move it to /home/bob/memos so you issue the command mv /home/ben/memos /home/bob. What is the results of this action? Choose one:


A). The files contained in /home/ben/memos are moved to the directory /home/bob/memos/memos.
B). The files contained in /home/ben/memos are moved to the directory /home/bob/memos.
C). The files contained in /home/ben/memos are moved to the directory /home/bob/.
D). The command fails since a directory called memos already exists in the target directory.
Answer : Option A

Explanation :

When using the mv command to move a directory, if a directory of the same name exists then a subdirectory is created for the files to be moved.


Question 18 :

Which of the following tasks is not necessary when creating a new user by editing the /etc/passwd file? Choose one:


A). Create a link from the user's home directory to the shell the user will use.
B). Create the user's home directory
C). Use the passwd command to assign a password to the account.
D). Add the user to the specified group.
Answer : Option A

Explanation :

There is no need to link the user's home directory to the shell command. Rather, the specified shell must be present on your system.


Question 19 :

You issue the following command useradd -m bobm But the user cannot logon. What is the problem? Choose one:


A). You need to assign a password to bobm's account using the passwd command.
B). You need to create bobm's home directory and set the appropriate permissions.
C). You need to edit the /etc/passwd file and assign a shell for bobm's account.
D). The username must be at least five characters long.
Answer : Option A

Explanation :

The useradd command does not assign a password to newly created accounts. You will still need to use the passwd command to assign a password.


Question 20 :

You wish to print the file vacations with 60 lines to a page. Which of the following commands will accomplish this? Choose one:


A). pr -l60 vacations | lpr
B). pr -f vacations | lpr
C). pr -m vacations | lpr
D). pr -l vacations | lpr
Answer : Option A

Explanation :

The default page length when using pr is 66 lines. The -l option is used to specify a different length.