~/cheat-sheets / journalctl
journalctl cheat sheet
Filter systemd logs precisely instead of scrolling forever – everyday journalctl commands, searchable and copyable in one click.
31 commands
Basics
Show the last 100 lines
journalctl -n 100Follow new entries live (like tail -f)
journalctl -fShow newest entries first
journalctl -rJump to the end with explanations (after failures)
journalctl -xeWrite output to a file without pager
journalctl --no-pager -n 500 > journal.txt
Units & processes
Show logs of a systemd unit
journalctl -u nginxFollow a unit's logs live
journalctl -u nginx -fShow several units interleaved
journalctl -u nginx -u php8.3-fpm --since "10 min ago"Entries from a specific process (PID)
journalctl _PID=1234Entries from a user (UID 33 = www-data)
journalctl _UID=33Filter by syslog identifier
journalctl -t sshdList all units present in the journal
journalctl -F _SYSTEMD_UNIT
Boots & kernel
List all stored boots with index
journalctl --list-bootsLogs since the current boot
journalctl -bErrors from the previous boot (after a crash)
journalctl -b -1 -p errKernel messages only (like dmesg)
journalctl -kLook for OOM killer events in the last boot
journalctl -k -b -1 | grep -i -E 'oom|killed process'
Time, priority & search
Entries from the last hour
journalctl --since "1 hour ago"Narrow down an exact time window
journalctl --since "2026-10-01 08:00" --until "2026-10-01 12:00"A unit's logs from yesterday
journalctl -u nginx --since yesterday --until todayOnly errors and worse since boot
journalctl -p err -bPriority range warning to error
journalctl -p warning..err --since todaySearch by pattern (regex, case-insensitive)
journalctl -u sshd -g "Failed password"
Output formats
Message text only, no timestamp or host
journalctl -u nginx -o catEntries with all fields as JSON
journalctl -u nginx -o json-pretty -n 5ISO timestamps in UTC (for tickets)
journalctl -o short-iso --utc -n 50
Journal maintenance
Show journal disk usage
journalctl --disk-usageDelete archived logs older than 2 weeks
⚠ Careful: changes or deletes datasudo journalctl --vacuum-time=2weeksShrink archived logs to 500 MB
⚠ Careful: changes or deletes datasudo journalctl --vacuum-size=500MRotate active journal files (before vacuum)
sudo journalctl --rotateCheck journal files for corruption
sudo journalctl --verify
No match.
New articles by e-mail
One e-mail per new article. No tracking, unsubscribe any time. As a thank-you after confirming: my “Server operations & patching” checklist (PDF).