This set of Unix Multiple Choice Questions & Answers (MCQs) focuses on “General Purpose Commands – 2”.
1. history command displays the log of recently used commands.
a) True
b) False
View Answer
Explanation: 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
View Answer
Explanation: 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
View Answer
Explanation: 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.
$ who | tee user.txt
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
View Answer
Explanation: 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
View Answer
Explanation: 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
View Answer
Explanation: 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
View Answer
Explanation: 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
View Answer
Explanation: 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
View Answer
Explanation: 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.
Sanfoundry Global Education & Learning Series – Unix.
To practice all areas of Unix, here is complete set of 1000+ Multiple Choice Questions and Answers.
- Check Unix Books
- Apply for Computer Science Internship
- Check MCA Books
- Practice MCA MCQs
- Practice Computer Science MCQs