Practice & Assessment
Test your understanding of Module 5: Process Management and System Monitoring
Multiple Choice Questions
5Which command shows all running processes for all users with CPU and memory usage?
What does the kill -9 command do?
Which command shows disk usage in human-readable format for all mounted file systems?
How do you run a command in the background in Linux?
What does the load average in the uptime output represent?
Coding Challenges
1Process Investigation and Monitoring Report
Using the terminal, perform the following: Run ps aux and pipe the output through grep to find all processes owned by root and count them with wc -l. Find the PID of the sshd process using ps aux | grep sshd. Run sleep 300 in the background and note its PID. List background jobs with the jobs command. Run free -h and capture the output to a file called memory-report.txt. Run df -h and capture the output to disk-report.txt. Run uptime and append its output to a file called system-health.txt. Finally, use cat to display all three report files.
Mini Project
System Health Monitoring Script
Create a shell script called system-health.sh in your home directory. The script should collect and display the following information in a formatted report: the system uptime, CPU load averages, total and available memory (using free -h), disk usage for the root partition (using df -h /), the top 5 CPU-consuming processes (using ps aux --sort=-%cpu | head -6), and the top 5 memory-consuming processes (using ps aux --sort=-%mem | head -6). The script should write all output to a file called health-report.txt with a timestamp at the top. Make the script executable with chmod +x and run it. Verify the output file was created correctly.
