Skip to content
BENIBIX Learn

journalctl

Infrastructure⌨️ Linux & the Command LineProcesses and Services

Also known as journalctl Command, systemd Journal, System Log

A command that reads the system log. It can show one service at a time.

Think of it like

Think of it like a ship's logbook. Every event goes in, and you can read back what happened.

Example

Jack's web server will not start. He runs journalctl -u nginx and sees a typo in a settings file.

Why it matters

A service that fails rarely says why on screen. The reason is almost always in the log.

Definition

journalctl reads the system log that systemd keeps. Every service writes its messages there, with the time. You can show the messages for one service with -u and its name. Adding -f follows new lines as they arrive. It is the first place to look when a service will not start.

Example code

console
$ journalctl -u ssh -n 1
Nov 16 09:00:01 web1 systemd[1]: Started ssh.service - OpenBSD Secure Shell server.
The last log line for the SSH service. It says when the service started.
Every daemon writes into the journal at the bottom. journalctl reads it back.

Common mistake

Scrolling the whole log by hand. Narrow it to one service with -u.

Key takeaways

  1. 1
    One log. Every service writes to it.
  2. 2
    -u for one service. Shows only that service.
  3. 3
    -f to follow. Watch new lines arrive.

Learn it properly