Mission 24 of 30

System Monitoring and Performance

Collect a small health report from memory, processes, uptime, and logs.

Observe memory, uptime, processes, logs, and repeated command output.

35–45 min Week 4 · Scripting, scheduling, customization, final project Ubuntu terminal
Your outcome: You can check system health without changing anything.
Practice inside ~/linux-practice. Check your setup before you begin. Prerequisite: Basic Networking Commands .

What you’ll practice

  • Inspect memory and uptime
  • Sort processes
  • Use watch and stop it

The mental model

  • Monitoring is usually read-only.
  • top, watch, and less-like tools have exit keys.
  • Ctrl+C stops watch.

Try it in your terminal

Memory and uptime

Read-only system view

Shows memory, uptime, and short virtual memory stats.

Run from ~/linux-practice

free -h
uptime
vmstat 1 2

Process snapshots

Read-only system view

Shows a non-interactive top snapshot and memory-heavy processes.

Run from ~/linux-practice

top -b -n 1 | head -20
ps aux --sort=-%mem | head -10

Logs and watch

Read-only system view

Reads recent logs only when systemd is running, then starts a repeating clock. This handles non-systemd distributions and WSL environments where systemd is disabled. Stop watch with Ctrl+C.

Run from ~/linux-practice

if command -v journalctl >/dev/null && [ "$(ps -p 1 -o comm=)" = systemd ]; then
  journalctl -n 20 --no-pager
else
  echo "systemd journal is not available in this environment"
fi
watch -n 2 date

Put it into practice

  1. Use ps to find the top memory process.
  2. Run watch date and stop it with Ctrl+C.

Check your result

The report captures a readable snapshot without changing the system.

Common mistakes

  • You start `watch` and stare at a screen that won't respond to your typing. watch runs until you stop it. Press Ctrl+C. Same with top — press q to quit. If you don't know the exit key, you're trapped in the tool.
  • You see a warning in `journalctl` and panic. A warning is evidence to investigate, not a complete diagnosis. Read nearby messages and confirm the affected service before acting.

Check your understanding

Explain these in your own words. If you’re unsure, revisit the examples before moving on.

  1. How do you stop watch?
  2. Which command shows memory usage?

Your practice, your pace

Loading saved progress…

Discussion

Continue the conversation about this guide. Loading comments connects to GitHub Discussions through giscus.

Open community discussions on GitHub

Check before you copy

This command needs care. Read its context, confirm the target and location, and keep a recovery path.

Copying does not run a command.