Top 50 Unix MCQ Questions & Answers

This post presents 50 multiple-choice questions (MCQs) to test your knowledge of the Unix operating system. Each MCQ has an answer and explanation.

UNIX is a powerful operating system known for its simplicity, flexibility, and portability. It has become a standard for many systems, and understanding UNIX commands and concepts is essential for working in various computing environments. The following MCQs cover key concepts, commands, and features in UNIX.

1. What does UNIX stand for?

a) Universal Internet Exchange
b) Uniplexed Information and Computing System
c) Unorganized Information Network
d) United Interface Network Exchange

2. Which command is used to display the current directory in UNIX?

a) pwd
b) ls
c) cd
d) dir

3. What is the use of the ls command in UNIX?

a) It lists files and directories in the current directory
b) It creates a new directory
c) It deletes a file
d) It changes the current directory

4. Which UNIX command is used to create a new directory?

a) touch
b) mkdir
c) rmdir
d) cp

5. Which UNIX command is used to remove a file?

a) rm
b) mv
c) delete
d) erase

6. What does the chmod command do in UNIX?

a) Changes the owner of a file
b) Changes the permissions of a file
c) Modifies the file content
d) Deletes a file

7. What does the ps command do in UNIX?

a) Shows the list of currently running processes
b) Prints system information
c) Stops a running process
d) Powers off the system

8. Which command is used to terminate a process in UNIX?

a) end
b) kill
c) stop
d) quit

9. Which command is used to change the ownership of a file in UNIX?

a) chown
b) chgrp
c) chmod
d) own

10. Which command is used to copy files in UNIX?

a) cp
b) mv
c) rm
d) copy

11. What is the default text editor in UNIX?

a) emacs
b) nano
c) vi
d) gedit

12. What is the function of the man command in UNIX?

a) To manage system resources
b) To display manual pages for commands
c) To monitor network activity
d) To display memory usage

13. Which command is used to move files in UNIX?

a) cp
b) mv
c) rm
d) move

14. Which command in UNIX is used to count the number of lines, words, and characters in a file?

a) wc
b) count
c) nl
d) grep

15. What is the purpose of the grep command in UNIX?

a) To find and display lines in a file that match a pattern
b) To list the files in a directory
c) To remove files from the system
d) To count the number of lines in a file

16. Which command is used to display the first few lines of a file in UNIX?

a) head
b) tail
c) cat
d) more

17. What does the tail command do in UNIX?

a) Displays the last few lines of a file
b) Displays the first few lines of a file
c) Shows the contents of a file
d) Lists files in a directory

18. How do you display all currently logged-in users in UNIX?

a) who
b) w
c) users
d) All of the above

19. What does the df command display in UNIX?

a) Disk space usage
b) File system type
c) Memory usage
d) List of files in a directory

20. What does the top command do in UNIX?

a) Displays the contents of a file
b) Shows system uptime
c) Displays real-time information about running processes
d) Lists all files in a directory

21. What does the du command display in UNIX?

a) Disk usage of files and directories
b) List of open files
c) User information
d) CPU usage

22. Which UNIX command is used to display the current system time and date?

a) time
b) date
c) clock
d) uptime

23. What does the uptime command show in UNIX?

a) The system's uptime since the last reboot
b) CPU usage
c) Disk space usage
d) List of active users

24. Which command in UNIX is used to remove an empty directory?

a) rmdir
b) rm
c) deldir
d) delete

25. What is the purpose of the chmod command in UNIX?

a) To change file permissions
b) To change the ownership of a file
c) To modify the content of a file
d) To delete files

26. What does the pwd command do in UNIX?

a) Prints the working directory
b) Changes the current directory
c) Displays process information
d) Prints file contents

27. What is the purpose of the cat command in UNIX?

a) To concatenate and display the content of files
b) To list all files in a directory
c) To change file permissions
d) To move files between directories

28. Which command in UNIX is used to search for a specific pattern in files?

a) grep
b) find
c) locate
d) search

29. Which command is used to change the group ownership of a file in UNIX?

a) chgrp
b) chmod
c) chown
d) grpmod

30. What does the df -h command do in UNIX?

a) Displays disk space usage in human-readable format
b) Displays free memory
c) Displays hidden files
d) Displays system uptime

31. What is the function of the ps command in UNIX?

a) To list the running processes
b) To display disk space usage
c) To change file permissions
d) To delete files

32. Which command is used to kill a process in UNIX?

a) kill
b) stop
c) end
d) exit

33. Which command in UNIX is used to search for files in a directory hierarchy?

a) find
b) locate
c) grep
d) search

34. What does the touch command do in UNIX?

a) Creates a new, empty file
b) Changes file permissions
c) Displays file content
d) Moves files between directories

35. Which command is used to display a file’s content one page at a time?

a) more
b) less
c) cat
d) head

36. What is the purpose of the tar command in UNIX?

a) To create and manage archive files
b) To delete files
c) To view file permissions
d) To display file contents

37. What is the function of the ln command in UNIX?

a) To create links to files
b) To list files in a directory
c) To create new directories
d) To move files

38. Which command is used to extract a .tar.gz archive in UNIX?

a) tar -xzf
b) tar -cvf
c) unzip
d) untar

39. What does the df command display in UNIX?

a) Disk space usage
b) File permissions
c) Process information
d) Network usage

40. What is the purpose of the gzip command in UNIX?

a) To compress files
b) To extract files
c) To display file contents
d) To list files in a directory

41. What does the history command do in UNIX?

a) Displays the list of previously executed commands
b) Displays system log files
c) Shows the list of active users
d) Displays recently modified files

42. What does the bg command do in UNIX?

a) Moves a process to the background
b) Terminates a process
c) Pauses a process
d) Resumes a paused process in the foreground

43. What does the fg command do in UNIX?

a) Brings a background process to the foreground
b) Pauses a process
c) Terminates a background process
d) Lists active processes

44. Which command is used to display the content of a file in reverse order?

a) tac
b) cat
c) head
d) tail

45. What does the whoami command do in UNIX?

a) Displays the current username
b) Displays system information
c) Shows the current directory
d) Lists active processes

46. Which command in UNIX is used to display system information?

a) uname
b) top
c) df
d) ps

47. What does the alias command do in UNIX?

a) Creates shortcuts for commands
b) Changes file ownership
c) Removes files
d) Renames files

48. What is the purpose of the nohup command in UNIX?

a) To run a command that will continue running after logout
b) To display system processes
c) To display system uptime
d) To log off the system

49. Which command in UNIX is used to change the ownership of a file?

a) chown
b) chmod
c) chgrp
d) owner

50. What is the purpose of the mount command in UNIX?

a) To mount a file system
b) To format a disk
c) To list all file systems
d) To create directories

These 50 UNIX MCQ questions and answers cover the essential commands and concepts needed to operate in a UNIX environment. From managing files and processes to configuring file systems, these questions provide a comprehensive understanding of how UNIX systems function.

Comments