Suggested day 2420–30 minutesRead-only system view

Mission 4 of 5

System Monitoring and Performance

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

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

Outcome: You can check system health without changing anything.

Mental model

Understand what is happening

Monitoring is usually read-only.

top, watch, and less-like tools have exit keys.

Ctrl+C stops watch.

Guided lab

Work through the mission

1

Memory and uptime

Read-only

Shows memory, uptime, and short virtual memory stats.

Terminal
free -h
uptime
vmstat 1 2
2

Process snapshots

Read-only

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

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

Logs and watch

Read-only

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.

Terminal
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

Checkpoint

Verify the mission

The report captures a readable snapshot without changing the system.

Try it yourself

One step without a recipe

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

Need a hint?

When you're stuck in `top` or `watch` and the terminal seems frozen, press `q` for top and Ctrl+C for watch. Knowing how to exit a tool is as important as knowing how to run it.

Explain it back

Before you move on

  • How do you stop watch?
  • Which command shows memory usage?

Shortcuts:Alt + ← previous lessonAlt + → next lessonAlt + H home? focus search