$
Learn Linux handbook
en
XP:0
Quest 90Log-Reader
+220 XP

System Logging (journalctl)

Launch Interactive Terminal for This Quest→No installation required • Runs fully in browser

Concept & Overview

Now that you can start and stop background services with systemctl, how do you troubleshoot them when they fail? The journalctl utility lets you inspect system logs generated by services managed by systemd.

- By default, journalctl shows all system logs. Because this can be massive, we filter them to stay focused.
- The -u option filters logs to only show messages from a specific service (e.g. journalctl -u apache2).
- The -n option displays only the most recent entries (e.g. journalctl -n 5 for the last 5 logs).
- The -f (follow) flag displays logs in real-time as they are written.

Let's investigate the web server logs. Run journalctl -u apache2 to filter system logs for the apache2 service. Then run journalctl -n 5 to view the last 5 general system log messages.

Command Syntax Reference

Command / SyntaxDescription
journalctl -u apache2Show logs for the apache2 service
journalctl -n 5Show the last 5 system log messages

Verification Objectives

These conditions will be automatically verified when you run commands inside the interactive terminal simulator:

  • ○
    Filter logs for the apache2 service using journalctl -u
  • ○
    View the last few log entries using journalctl -n

Ready to complete Quest 90?

Test your skills live in the browser terminal with an emulated Linux filesystem, real-time command evaluation, and instant step-by-step hints.