Quiz 2 Flashcards

1
Q

Which of the following commands enables you to redirect standard output as well as standard error to a file?

A

> file 2>&1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

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

A

a. /etc/profile
and
c. ~/.bash_profile

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

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

The directory that contains the script is not in the PATH.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

A user wants to remove her complete history. Which of the following approaches would do that?

A

Remove the ~/.bash_history file and type history -c.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Which of the following is not a valid method to repeat a command from history?

a. Press Ctrl-r and start typing a part of the command.
b. Type ! followed by the first letters in the command.
c. Type ! followed by the number of the command as listed in history.
d. Press Ctrl-x followed by the number in history.

A

D. Press Ctrl-x followed by the number in history.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

For which of the following items can Bash completion be used?
a. Commands
b. Files
c. Variables
d. All of the above

A

All of the above

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Which approach works best if during the login process you want to show a message to all users who have just logged in to a shell session on your server?

A

Put the message in /etc/motd.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

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

C. Type mandb to update the mandb database.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly