6.
Which of the following enables you to redirect standard output as well as
errors to a file?
- A.1&2> file
- B.2>&1 file
- C.>1&2 file
- D.1>2& file
- Answer & Explanation
- Report
Answer : [B]
Explanation :
Explanation :
Answer B shows the correct syntax. The 2 redirects error messages, and &1 makes sure that the same is done for STDOUT. |
7.
You are looking for a variable that is set in a bash login shell for all users.
Which of the following files is the most likely location where this variable is
set? (Choose two.)
- A./etc/profile
- B./etc/bashrc
- C.~/.bash_profile
- D.~/.bashrc
- Answer & Explanation
- Report
Answer : [A, B]
Explanation :
Explanation :
/etc/profile is the file that is processed for all users who are starting a login shell. |
8.
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 & Explanation
- Report
Answer : [C]
Explanation :
Explanation :
On Linux, the current directory is not set in the PATH variable. |
9.
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 & Explanation
- Report
Answer : [D]
Explanation :
Explanation :
A pipe is used to process the output of the first command and use it as input of the second command. |
10.
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 & Explanation
- Report
Answer : [A]
Explanation :
Explanation :
The command history -c removes the in-memory state from the history file of current history. Remove ~/.bash_history also to make sure that all history is removed. |