Menu
CoddyTech

System Health Checker

Part of the Fundamentals section of Coddy's Terminal journey. Lesson 82 of 82.

challenge icon

Challenge

Easy

Create a shell script called health.sh that displays a system health report with the following sections:

  1. Start with the shebang line (#!/bin/bash)
  2. Print === System Health Report ===
  3. Print User: followed by the output of id -u
  4. Print Current Directory: followed by the output of pwd
  5. Print Running Processes: followed by the count of lines in processes.txt (simulating process count)
  6. Print === End of Report ===

Use command substitution $(command) to capture command output within your echo statements.

Make the script executable and run it. The labels must match exactly, while the user id, the directory and the process count come from the machine you are running on, so your numbers can differ:

=== System Health Report ===
User: 1002
Current Directory: /tmp/user/home
Running Processes: 9
=== End of Report ===

Try it yourself

Terminal

All lessons in Fundamentals

Practice on your own: Terminal playground