UNIX Question and Answer – System Monitoring
UNIX MCQ – Multiple Choice Questions for exam, interview, and Entrance Test
1. Which command is used to view the contents of the system log files in UNIX?
a) syslog
b) logview
c) tail
d) dmesg
Answer: d) dmesg
Explanation: The dmesg command displays the contents of the kernel ring buffer, which contains system log messages.
2. What is the primary purpose of monitoring system log files in UNIX?
a) Monitor CPU usage
b) Monitor disk space
c) Monitor system events and errors
d) Monitor network traffic
Answer: c) Monitor system events and errors
Explanation: System log files in UNIX contain important information about system events, errors, and warnings, which are crucial for system monitoring and troubleshooting.
3. Which tool is commonly used for system performance monitoring in UNIX?
a) syscheck
b) top
c) sysstat
d) ps
Answer: c) sysstat
Explanation: The sysstat package provides various utilities for system performance monitoring, including sar, iostat, mpstat, and pidstat.
4. What does the sar command do in UNIX?
a) Display system logs
b) Monitor CPU usage
c) Monitor disk I/O statistics
d) Monitor memory usage
Answer: b) Monitor CPU usage
Explanation: The sar command in UNIX is used to collect, report, and save system activity information, including CPU, memory, disk, and network usage.
5. Which option of the sar command is used to display CPU usage statistics?
a) -m
b) -c
c) -d
d) -r
Answer: b) -c
Explanation: The sar command with the -c option is used to display CPU usage statistics, including CPU utilization, user time, system time, and idle time.
6. What does the iostat command in UNIX primarily monitor?
a) Memory usage
b) CPU usage
c) Disk I/O statistics
d) Network traffic
Answer: c) Disk I/O statistics
Explanation: The iostat command in UNIX is used to monitor disk I/O statistics, including read and write rates, disk utilization, and average wait time.
7. Which option of the iostat command is used to display extended statistics for all devices?
a) -e
b) -x
c) -a
d) -d
Answer: b) -x
Explanation: The iostat command with the -x option is used to display extended statistics for all devices, including extended disk utilization metrics.
8. What does the vmstat command do in UNIX?
a) Monitor virtual memory statistics
b) Monitor network interface statistics
c) Monitor CPU utilization
d) Monitor disk I/O statistics
Answer: a) Monitor virtual memory statistics
Explanation: The vmstat command in UNIX is used to display virtual memory statistics, including memory usage, paging, and swapping activity.
9. Which option of the vmstat command is used to display disk I/O statistics?
a) -d
b) -m
c) -i
d) -p
Answer: a) -d
Explanation: The vmstat command with the -d option is used to display disk I/O statistics, including disk reads, writes, and transfers.
10. What does the netstat command do in UNIX?
a) Monitor network interface statistics
b) Monitor disk I/O statistics
c) Monitor CPU utilization
d) Monitor virtual memory statistics
Answer: a) Monitor network interface statistics
Explanation: The netstat command in UNIX is used to display network interface statistics, including active network connections, routing tables, and interface configuration.
11. Which option of the netstat command is used to display listening ports and associated programs?
a) -l
b) -p
c) -n
d) -a
Answer: b) -p
Explanation: The netstat command with the -p option is used to display listening ports and associated programs or processes.
12. What is the primary purpose of monitoring system logs in UNIX?
a) Identify system bottlenecks
b) Monitor disk space usage
c) Monitor system events and errors
d) Monitor network bandwidth
Answer: c) Monitor system events and errors
Explanation: System logs in UNIX contain records of system events, errors, warnings, and informational messages, which are essential for monitoring system health and diagnosing issues.
13. Which command is used to display the last few lines of a log file in UNIX?
a) tail
b) head
c) grep
d) cat
Answer: a) tail
Explanation: The tail command in UNIX is used to display the last few lines of a file, such as a log file, which is commonly used for monitoring the latest events.
14. What does the grep command do in UNIX?
a) Display system logs
b) Monitor CPU usage
c) Search for text patterns in files
d) Monitor disk I/O statistics
Answer: c) Search for text patterns in files
Explanation: The grep command in UNIX is used to search for text patterns in files, including log files, based on specified criteria.
15. Which option of the grep command is used to perform a case-insensitive search?
a) -i
b) -c
c) -n
d) -v
Answer: a) -i
Explanation: The grep command with the -i option is used to perform a case-insensitive search for text patterns in files.
16. What does the wc command do in UNIX?
a) Count words, lines, and characters in a file
b) Display disk usage statistics
c) Display system logs
d) Monitor CPU usage
Answer: a) Count words, lines, and characters in a file
Explanation: The wc command in UNIX is used to count the number of words, lines, and characters in a file.
17. Which command is used to display a continuously updated list of system processes in UNIX?
a) ps
b) top
c) pstree
d) process
Answer: b) top
Explanation: The top command in UNIX displays a continuously updated list of system processes, sorted by various criteria such as CPU or memory usage.
18. What does the ps command do in UNIX?
a) Display system logs
b) Monitor CPU usage
c) Display information about running processes
d) Monitor disk I/O statistics
Answer: c) Display information about running processes
Explanation: The ps command in UNIX is used to display information about currently running processes, including their process IDs (PIDs), resource usage, and execution status.
19. Which option of the ps command is used to display information about all processes on the system?
a) -a
b) -e
c) -l
d) -x
Answer: b) -e
Explanation: The ps command with the -e option is used to display information about all processes on the system, including those not associated with a terminal.
20. What does the uptime command display in UNIX?
a) System boot time and uptime
b) CPU usage statistics
c) Memory usage statistics
d) Disk space usage statistics
Answer: a) System boot time and uptime
Explanation: The uptime command in UNIX displays the system’s current time, how long the system has been running, and the average system load over the past 1, 5, and 15 minutes.
21. Which command is used to display detailed information about CPU and memory usage in UNIX?
a) htop
b) atop
c) meminfo
d) loadavg
Answer: a) htop
Explanation: The htop command in UNIX is a more advanced alternative to the top command, providing detailed information about CPU and memory usage, as well as options for process management.
22. What is the purpose of the cron daemon in UNIX?
a) Monitor system logs
b) Schedule periodic tasks and jobs
c) Monitor CPU usage
d) Monitor disk I/O statistics
Answer: b) Schedule periodic tasks and jobs
Explanation: The cron daemon in UNIX is responsible for scheduling and executing periodic tasks and jobs according to predefined schedules specified in cron configuration files.
23. Which directory in UNIX contains log files generated by system services and daemons?
a) /var/log
b) /etc/log
c) /sys/log
d) /tmp/log
Answer: a) /var/log
Explanation: The /var/log directory in UNIX contains log files generated by various system services, daemons, and applications, which are essential for system monitoring and troubleshooting.
24. What is the purpose of logrotate in UNIX?
a) Rotate and compress log files
b) Monitor CPU usage
c) Monitor disk I/O statistics
d) Monitor network bandwidth
Answer: a) Rotate and compress log files
Explanation: Logrotate in UNIX is a utility used to rotate, compress, and manage log files automatically, ensuring efficient use of disk space and preventing log files from becoming too large.
25. Which command is used to check the syntax of the cron configuration files in UNIX?
a) croncheck
b) cronvalidate
c) cronchk
d) crontab
Answer: d) crontab
Explanation: The crontab command in UNIX is used to manage user-specific cron jobs, including installing, editing, and deleting cron entries, as well as checking the syntax of cron configuration files.
26. What does the “sar” command do in UNIX?
a) Display system logs
b) Monitor CPU usage
c) Monitor disk I/O statistics
d) Monitor system activity
Answer: d) Monitor system activity
Explanation: The “sar” command is used to collect, report, and save system activity information, including CPU, memory, disk, and network usage.
27. Which option of the “sar” command is used to display CPU utilization statistics?
a) -c
b) -m
c) -d
d) -u
Answer: d) -u
Explanation: The “sar” command with the “-u” option is used to display CPU utilization statistics, including user time, system time, and idle time.
28. What does the “atop” command do in UNIX?
a) Display system logs
b) Monitor CPU usage
c) Monitor disk I/O statistics
d) Monitor memory usage
Answer: b) Monitor CPU usage
Explanation: The “atop” command is used to monitor CPU usage, memory usage, disk I/O statistics, and process activity in real-time.
29. Which option of the “atop” command is used to display memory usage statistics?
a) -m
b) -r
c) -d
d) -p
Answer: b) -r
Explanation: The “atop” command with the “-r” option is used to display memory usage statistics, including total memory, used memory, and free memory.
30. What does the “pidstat” command do in UNIX?
a) Display system logs
b) Monitor CPU usage
c) Monitor disk I/O statistics
d) Monitor process activity
Answer: b) Monitor CPU usage
Explanation: The “pidstat” command is used to monitor CPU usage by individual processes in real-time.
31. Which option of the “pidstat” command is used to display CPU usage statistics for all processes?
a) -u
b) -p
c) -r
d) -I
Answer: a) -u
Explanation: The “pidstat” command with the “-u” option is used to display CPU usage statistics for all processes.
32. What does the “iftop” command do in UNIX?
a) Monitor CPU usage
b) Monitor disk I/O statistics
c) Monitor network bandwidth usage
d) Monitor memory usage
Answer: c) Monitor network bandwidth usage
Explanation: The “iftop” command is used to monitor network bandwidth usage in real-time.
33. Which option of the “iftop” command is used to display network traffic on a specific network interface?
a) -i
b) -n
c) -t
d) -r
Answer: a) -i
Explanation: The “iftop” command with the “-i” option is used to display network traffic on a specific network interface.
34. What does the “nmon” command do in UNIX?
a) Monitor CPU usage
b) Monitor disk I/O statistics
c) Monitor network traffic
d) Monitor system activity
Answer: d) Monitor system activity
Explanation: The “nmon” command is used to monitor various system activities, including CPU usage, memory usage, disk I/O statistics, and network traffic.
35. Which option of the “nmon” command is used to display CPU utilization statistics?
a) -c
b) -m
c) -d
d) -u
Answer: d) -u
Explanation: The “nmon” command with the “-u” option is used to display CPU utilization statistics.
36. What does the “iotop” command do in UNIX?
a) Monitor CPU usage
b) Monitor disk I/O statistics
c) Monitor network traffic
d) Monitor memory usage
Answer: b) Monitor disk I/O statistics
Explanation: The “iotop” command is used to monitor disk I/O statistics and identify processes that are generating the most disk I/O.
37. Which option of the “iotop” command is used to display disk I/O usage for each process?
a) -a
b) -p
c) -d
d) -r
Answer: a) -a
Explanation: The “iotop” command with the “-a” option is used to display disk I/O usage for each process.
38. What does the “logwatch” command do in UNIX?
a) Display system logs
b) Monitor CPU usage
c) Monitor disk I/O statistics
d) Monitor system activity
Answer: a) Display system logs
Explanation: The “logwatch” command is used to analyze and summarize system logs, providing insights into system activity, errors, and warnings.
39. Which option of the “logwatch” command is used to generate a report for a specific date range?
a) –start
b) –end
c) –range
d) –date
Answer: c) –range
Explanation: The “logwatch” command with the “–range” option is used to generate a report for a specific date range.
40. What does the “dstat” command do in UNIX?
a) Monitor CPU usage
b) Monitor disk I/O statistics
c) Monitor network traffic
d) Monitor system activity
Answer: d) Monitor system activity
Explanation: The “dstat” command is used to monitor various system resources, including CPU, memory, disk I/O, network traffic, and system activity.
41. Which option of the “dstat” command is used to display CPU utilization statistics?
a) -c
b) -m
c) -d
d) -u
Answer: d) -u
Explanation: The “dstat” command with the “-u” option is used to display CPU utilization statistics.
42. What does the “strace” command do in UNIX?
a) Monitor CPU usage
b) Monitor disk I/O statistics
c) Monitor system calls
d) Monitor memory usage
Answer: c) Monitor system calls
Explanation: The “strace” command is used to trace system calls and signals made by a process, providing insights into its behavior and performance.
43. Which option of the “strace” command is used to display the system calls made by a process?
a) -c
b) -p
c) -t
d) -s
Answer: b) -p
Explanation: The “strace” command with the “-p” option is used to attach to a running process and display the system calls it makes.
44. What does the “tcpdump” command do in UNIX?
a) Monitor CPU usage
b) Monitor disk I/O statistics
c) Monitor network traffic
d) Monitor memory usage
Answer: c) Monitor network traffic
Explanation: The “tcpdump” command is used to capture and analyze network traffic in real-time.
45. Which option of the “tcpdump” command is used to capture packets on a specific network interface?
a) -i
b) -n
c) -r
d) -w
Answer: a) -i
Explanation: The “tcpdump” command with the “-i” option is used to capture packets on a specific network interface.
46. What does the “ss” command do in UNIX?
a) Monitor CPU usage
b) Monitor disk I/O statistics
c) Monitor network sockets
d) Monitor system activity
Answer: c) Monitor network sockets
Explanation: The “ss” command is used to display information about network sockets, including listening ports, established connections, and network protocols.
47. Which option of the “ss” command is used to display TCP sockets?
a) -t
b) -u
c) -l
d) -a
Answer: a) -t
Explanation: The “ss” command with the “-t” option is used to display TCP sockets.
48. What does the “nettop” command do in UNIX?
a) Monitor CPU usage
b) Monitor disk I/O statistics
c) Monitor network traffic
d) Monitor memory usage
Answer: c) Monitor network traffic
Explanation: The “nettop” command is used to monitor network traffic in real-time, providing insights into network usage and bandwidth consumption.
49. Which option of the “nettop” command is used to display active network connections?
a) -a
b) -t
c) -l
d) -c
Answer: a) -a
Explanation: The “nettop” command with the “-a” option is used to display active network connections.
50. What does the “vnstat” command do in UNIX?
a) Monitor CPU usage
b) Monitor disk I/O statistics
c) Monitor network traffic
d) Monitor memory usage
Answer: c) Monitor network traffic
Explanation: The “vnstat” command is used to monitor network traffic and bandwidth usage over time, providing statistics on data transfer rates and total data usage.