250+ TOP MCQs on General Purpose Commands

Unix Interview Questions and Answers on “General Purpose Commands”.

1. history command displays the log of recently used commands.
a) True
b) False

Answer: a
Clarification: History command displays the list of recently used commands by the user which means whatever commands are used by the user in the current session will be displayed on the terminal using history command.

2. Which command is used by the user to change their login password in UNIX?
a) man
b) reset
c) passwd
d) cp

Answer: c
Clarification: Since UNIX is a multiuser system, it requires a password from every user who wants to log in to the system to help ensure that all the data and files of the user are secure from hackers and errant users. A user can simply change his/her login password by using the passwd command. Simply type this command on the terminal and then enter the old password, which after successful verification would allow the user to input a new password for his login.

3. Which command handles a character stream by duplicating its input?
a) tree
b) tee
c) tty
d) ls

Answer: b
Clarification: tee is an external command which handles a stream of characters by duplicating its input. It saves one copy in a file and writes the other to standard output. tee command can be placed anywhere in a pipeline.

The above command displays the output of who command on the terminal and also saves this output in a file named user.txt.

4. We can use man command for displaying the documentation of man itself.
a) True
b) False

Answer: a
Clarification: Since man is also a UNIX command, it is necessary to know how man itself is used. For this purpose, use the same command to view its own documentation:

$ man man	// viewing man pages with man

5. When backspace doesn’t work to erase characters, we can use _____
a) ctrl-f
b) ctrl-h
c) ctrl-c
d) ctrl-u

Answer: b
Clarification: Sometimes it may happen that backspace doesn’t work and whenever it is pressed, ^H is displayed on the terminal. To resolve this problem, we can use control key i.e. ctrl-H. Ctrl-u is used for killing a line altogether without executing it and Ctrl-c interrupts the program and bring back the prompt.

6. For interrupting a command, we can use _____
a) ctrl-f
b) esc
c) ctrl-h
d) ctrl-c

Answer: d
Clarification: Sometimes, a program goes on running on for an hour and does not seem to complete. To interrupt that command we can use the control key, ctrl-c. Ctrl-h is used to erase character by character when backspace doesn’t work.

7. Ctrl-S stops scrolling of screen output and ________
a) locks terminal
b) delete a character
c) locks keyboard
d) delete a line

Answer: c
Clarification: There are various keyboard commands to try when things go wrong. One of these commands is Ctrl-s which stops scrolling of screen output and locks the keyboard.

8. Which control unlocks the keyboard?
a) ctrl-u
b) ctrl-c
c) ctrl-z
d) ctrl-q

Answer: d
Clarification: ctrl-q resumes the scrolling of screen output and unlocks the keyboard. Ctrl-h is used to erase character by character when backspace doesn’t work while and Ctrl-c interrupts the program and bring back the prompt.

9. Which command is used for killing a line?
a) ctrl-k
b) del
c) esc
d) ctrl-u

Answer: d
Clarification: If the command line contains too many mistakes, we could prefer to kill the line altogether without executing it using ctrl-u. It erases everything in the line and returns the cursor to the beginning of the line.

Leave a Reply

Your email address will not be published.