journalctl

Query and display systemd journal logs.

low risk

interactive breakdown — edit the command and press Explain
$ 
⚠ Risks & cautions
What it does

journalctl is the primary tool for accessing systemd's structured binary journal. It supports filtering by unit, time range, priority, and boot. Unlike tail on flat log files, it understands log metadata and allows complex structured queries.

Common flags
FlagMeaning
-u --unitFilter by systemd service unit
-f --followFollow journal in real time
-n --linesShow last N lines
-p --priorityFilter by priority (0=emerg to 7=debug)
--sinceShow logs since a timestamp
--untilShow logs until a timestamp
-b --bootShow logs from current boot (-1 for previous)
-o --outputOutput format: json, json-pretty, short, verbose
Examples
journalctl -u nginx -fFollow nginx service logs · explain & risk-check →
journalctl -p err -bShow errors from current boot only · explain & risk-check →
journalctl --since '2024-01-15 10:00' --until '2024-01-15 11:00'Logs in a specific time window · explain & risk-check →
journalctl -u kubelet -n 100 --no-pagerLast 100 kubelet log lines · explain & risk-check →
journalctl -o json-pretty -u sshd | jq '.MESSAGE'Structured log output for parsing · explain & risk-check →
Pro tip

Use `journalctl -b -1 -p err` to review errors from the previous boot after a crash — far faster than reconstructing the timeline from multiple log files.

Related
systemctl dmesg tail
Open the full explainer →More in System & Processes

Reference text is hand-written and may be incomplete — check man journalctl for your version. Test destructive commands on a non-production system first.