Unix Questions and Answers – General Purpose Commands – 2

«
»

This set of Unix Interview Questions and Answers focuses on “General Purpose Commands – 2”.

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

Answer: a
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.
advertisement

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

Answer: c
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

Answer: b
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.

advertisement
advertisement
$ 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.

Become Top Ranker in Unix Now!
advertisement

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

Answer: a
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

advertisement

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

Answer: b
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.
advertisement

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

Answer: d
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

Answer: c
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

Answer: d
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

Answer: d
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 for Interviews, here is complete set of 1000+ Multiple Choice Questions and Answers.

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & technical discussions at Telegram SanfoundryClasses.