You are on page 1of 1

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

Which of the following commands enables you to redirect standard output as well as
standard error to a file?
A. 1&2> file
B. > file 2>&1
C. >1&2 file
D. 1>2& file
ANSWER: B

Which of the following commands enables you to replace every occurrence of old with
new in a text file that is opened with vi?
A. :%s/old/new/g
B. :%r/old/new/
C. :s/old/new/g
D. r:/old/new
ANSWER: A

Which file do you need to change if you want a variable to be set for every shell
that is started?
A. /etc/profile
B. /etc/bashrc
C. ~/.bash_profile
D. ~/.bashrc
ANSWER: B

What can you add to a command to make sure that it does not show an error message,
assuming that you do not care about the information that is in the error messages
either?
A. Add 2> /dev/null to a command
B. Add 1>2& /dev/null to a command
C. Add >1&2 file to a command
D. Add 2> file to a command
ANSWER: A

How do you read the current contents of the $PATH variable?


A. echo $PATH
B. print $PATH
C. read $PATH
D. echo PATH
ANSWER: A

Which command enables you to see the results of the ps aux command in a way that
you can easily browse up and down in the results?
A. ps aux | less
B. ps aux | cat
C. ps aux > less
D. less | ps aux
ANSWER: A

You might also like