You are on page 1of 7

A user has created a script with the name myscript.

He tries to run it using the


command myscript, but it is not started. The user has verified that the script
permissions are set as executable. Which of the following is the most likely
explanation?
A. An internal command is preventing the startup of the script.
B. Users are not allowed to run scripts.
C. The directory that contains the script is not in the PATH.
D. The script does not have appropriate permissions.
ANSWER: C

You need the output of the command ls to be used as input for the less command.
Which of the following examples will do that for you?
A. ls > less
B. ls >> less
C. ls >| less
D. ls | less
ANSWER: D

A user wants to remove his complete history. Which of the following approaches
would do that?
A. Remove the ~/.bash_history file and type history -c.
B. Type history -c.
C. Remove the ~/.bash_history file.
D. Type history -c and close the current shell.
ANSWER: A

Which of the following is not a valid method to repeat a command from history?
A. Use Ctrl+R and start typing a part of the command.
B. Use ! followed by the first letters in the command.
C. Use ! followed by the number of the command as listed in history.
D. Use Ctrl+X followed by the number in history.
ANSWER: D

For which of the following items can bash completion be used?


A. Commands
B. Files
C. Variables
D. All of the above
ANSWER: D

Which command line-editing shortcut can be used for jumping to the beginning of the
command line?
A. Ctrl + a
B. Ctrl + e
C. Ctrl + u
D. Ctrl + k
ANSWER: A

Which command line-editing shortcut can be used for jumping to the end of the
command line?
A. Ctrl + a
B. Ctrl + e
C. Ctrl + u
D. Ctrl + k
ANSWER: B

Which command line-editing shortcut can be used to clear from the cursor to the
beginning of the command line?
A. Ctrl + a
B. Ctrl + e
C. Ctrl + u
D. Ctrl + k
ANSWER: C

Which command line-editing shortcut can be used to clear from the cursor to the end
of the command line?
A. Ctrl + a
B. Ctrl + e
C. Ctrl + u
D. Ctrl + k
ANSWER: D

Which command line-editing shortcut can be used to copy the last argument of
previous commands?
A. Ctrl + Left Arrow
B. Ctrl + Right Arrow
C. Ctrl + r
D. Esc + .
ANSWER: D

The _________ command scans the beginning of a file's contents and displays what
type it is.
A. scan
B. type
C. find
D. file
ANSWER: D

When a regular user starts a shell, the default prompt ends with a _________
character.
A. #
B. ~
C. $
D. !
ANSWER: C

The _________ command displays a list of previously executed commands prefixed


with a command number.
A. history
B. find
C. search
D. execute
ANSWER: A

How to display the current time in the following format: HH:MM:SS A/PM?
A. date +%r
B. date +%R
C. date +%x
D. date +%c
ANSWER: A

Which directory contains the system kernel?


A. /etc
B. /
C. /boot
D. /proc
ANSWER: C
Which directory contains static, persistent system configuration data?
A. /etc
B. /
C. /boot
D. /proc
ANSWER: A

Which of the following is the system's root directory?


A. /etc
B. /
C. /boot
D. /proc
ANSWER: B

Which directory contains dynamic configuration data, such as FTP and websites?
A. /var
B. /usr
C. /tmp
D. /run
ANSWER: A

Which directory contains dynamic, non-persistent application runtime data?


A. /var
B. /usr
C. /tmp
D. /run
ANSWER: D

Which directory contains installed software programs and libraries?


A. /var
B. /usr
C. /tmp
D. /run
ANSWER: B

Which directory contains the root user’s home directory?


A. /home
B. /sbin
C. /root
D. /usr
ANSWER: C

The /dev directory contains the


A. device drivers
B. device files
C. kernel modules of device drivers
D. none of the above
ANSWER: B

Regular user commands and utilities are stored in


A. /dev
B. /usr/bin
C. /usr/sbin
D. /tmp
ANSWER: B

System administration binaries, for root use, are stored in


A. /dev
B. /usr/bin
C. /usr/sbin
D. /tmp
ANSWER: C

User home directories are located under this directory.


A. /home
B. /sbin
C. /root
D. /usr
ANSWER: A

Under which directory would you expect to find nonessential program files?
A. /boot
B. /bin
C. /sbin
D. /usr
ANSWER: D

Under which directory would you expect to find log files?


A. /proc
B. /run
C. /var
D. /usr
ANSWER: C

Which command enables you to show all files in the current directory so that the
newest files are listed last?
A. ls -lRt
B. ls -lrt
C. ls -alrt
D. ls -alr
ANSWER: C

Which command enables you to copy hidden files as well as regular files from /home/
$USER to the current directory?
A. cp -a /home/$USER .
B. cp -a /home/$USER/* .
C. cp -a /home/$USER/. .
D. cp -a home/$USER. .
ANSWER: C

Which command enables you to rename the file myfile to mynewfile?


A. mv myfile mynewfile
B. rm myfile mynewfile
C. rn myfile mynewfile
D. ren myfile mynewfile
ANSWER: A

The _________ command displays the full path name of the current location.
A. cd
B. ls
C. pwd
D. touch
ANSWER: C

A/An _________ is a fully qualified name, beginning at the root (/) directory and
specifying each subdirectory traversed to reach and uniquely represent a single
file.
A. absolute path
B. relative path
C. pwd
D. none of the above
ANSWER: A

A/An _________ identifies a unique file, specifying only the path necessary to
reach the file from the working directory.
A. absolute path
B. relative path
C. pwd
D. none of the above
ANSWER: B

Which command enables you to list the current user's home directory (long format)
in simplest syntax, when it is not the current location.
A. ls -l ~
B. ls -al
C. ls -cl
D. ls -il
ANSWER: A

Which command enables you to list the current location (long format) with hidden
files.
A. ls -l ~
B. ls -al
C. ls -cl
D. ls -il
ANSWER: B

Which command enables you to show the contents of the current directory, in
addition to all of its subdirectories.
A. ls -l
B. ls -a
C. ls -d
D. ls -R
ANSWER: D

Which command enables you to return to the current user's home directory.
A. cd -
B. cd ..
C. cd ../..
D. cd
ANSWER: D

Which command enables you to return to the most previous working directory.
A. cd -
B. cd ..
C. cd ../..
D. cd
ANSWER: A

Which command enables you to move up two levels from the current location.
A. cd -
B. cd ..
C. cd ../..
D. cd
ANSWER: C

Which command enables you to move up to the parent of the current location.
A. cd -
B. cd ..
C. cd ../..
D. cd
ANSWER: B

Which command enables you to move to the binaries location, from any current
location.
A. cd /bin
B. cd bin
C. cd
D. cd .
ANSWER: A

Which command enables you to move to the binaries location, from the root
directory.
A. cd /bin
B. cd bin
C. cd
D. cd .
ANSWER: B

The _________ command renames files in the same directory, or relocates files to a
new directory.
A. ren
B. rm
C. rn
D. mv
ANSWER: D

You are using man -k user, but you get the message “nothing appropriate.” Which of
the following solutions is most likely to fix this for you?
A. Type updatedb to update the man database.
B. Type makewhatis to update the man database.
C. Type mandb to update the man database.
D. Use man -K, not man -k.
ANSWER: C

In linux filesystem, the passwords of different users are stored in


A. /etc/passwd file
B. /bin/passwd file
C. /etc/shadow file
D. /bin/shadow file
ANSWER: C

Which command enables you to find the correct man page based on keyword usage?
A. man -f
B. man -w
C. man -l
D. man -k
ANSWER: D

What command enables you to display a list of current directory contents, where the
newest files are listed first?
A. ls -lRt
B. ls -lrt
C. ls -alrt
D. ls -alt
ANSWER: D
Which command enables you to wipe an entire directory structure, including all of
its contents?
A. rm -i /directory
B. rm -d /directory
C. rm -rf /directory
D. rm /directory
ANSWER: C

How would you copy all files that have a name that starts with a, b, or c from the
directory /etc to your current directory?
A. cp /etc/[abc]* .
B. cp /etc/[abc]? .
C. cp /etc/[abc]? ~
D. cp /etc/[abc]* ~
ANSWER: A

Which command was developed to show only the first 10 lines in a text file?
A. top
B. head
C. first
D. cat
ANSWER: B

Which command enables you to count the number of words in a text file?
A. count
B. list
C. ls -l
D. wc
ANSWER: D

Which key on your keyboard do you use in less to go to the last line of the current
text file?
A. End
B. PageDown
C. q
D. G
ANSWER: D

Which command enables you to show the last five lines from ~/samplefile?
A. tail -n 5 ~/samplefile
B. last -n 5 ~/samplefile
C. cat -n 5 ~/samplefile
D. less -n 5 ~/samplefile
ANSWER: A

After opening command output using tail -f ~/mylogfile, how do you stop showing
output?
A. Ctrl + A
B. Ctrl + B
C. Ctrl + C
D. Ctrl + D
ANSWER: C

You might also like