Skip to main content

journalctl Cheatsheet

By Dejan Panovski Updated on Download PDF

Quick reference for viewing and filtering systemd journal logs

journalctl reads the systemd journal and lets us filter logs by unit, time, priority, boot, process, and more. This cheatsheet covers the most useful commands for troubleshooting and day-to-day log analysis.

Basic Usage

View logs and follow output.

CommandDescription
journalctlShow all logs
journalctl -rShow logs in reverse order (newest first)
journalctl -fFollow new logs (tail -f)
journalctl -n 50Show last 50 lines
journalctl -eJump to end of logs
journalctl -xShow explanatory messages

By Unit / Service

Filter by systemd unit.

CommandDescription
journalctl -u nginxLogs for a service
journalctl -u nginx -u php-fpmLogs for multiple units
journalctl -u nginx --since todayLogs from today
journalctl -u nginx -fFollow service logs
journalctl -u nginx -n 100Last 100 lines for a service
journalctl -u nginx --no-pagerPrint directly without pager
journalctl -u nginx --output=short-isoService logs with ISO timestamps

Time Filters

Limit logs by time range.

CommandDescription
journalctl --since "2026-02-01"Logs since date
journalctl --since "1 hour ago"Logs from last hour
journalctl --since "yesterday"Logs since yesterday
journalctl --since "2026-02-01 10:00" --until "2026-02-01 12:00"Logs in time window
journalctl --since today --until nowLogs for the current day
journalctl --since "30 min ago" -p errRecent errors only

Boot Logs

View logs from specific boots.

CommandDescription
journalctl -bCurrent boot logs
journalctl -b -1Previous boot logs
journalctl --list-bootsList boot IDs
journalctl -b <ID>Logs for a boot ID
journalctl -b -1 -p warningWarnings from previous boot
journalctl -b --since "10 min ago"Current boot logs in recent window

By Process / Source

Filter logs by process name, executable path, PID, and identifier.

CommandDescription
journalctl _COMM=sshdLogs from process name
journalctl _EXE=/usr/sbin/sshdLogs from executable path
journalctl _PID=1234Logs from a specific PID
journalctl SYSLOG_IDENTIFIER=nginxLogs by syslog identifier
journalctl _UID=1000Logs from a specific user ID
journalctl _SYSTEMD_UNIT=nginx.serviceFilter with explicit unit field

Priority and Kernel

Filter by severity and kernel messages.

CommandDescription
journalctl -p errErrors and above
journalctl -p warningWarnings and above
journalctl -p 3Priority number (0-7)
journalctl -kKernel messages
journalctl -k -bKernel messages for current boot
journalctl -k -p err -b -1Previous boot kernel errors

Output Formats

Change how logs are displayed.

CommandDescription
journalctl -o short-isoISO timestamps
journalctl -o short-preciseHigh precision timestamps
journalctl -o jsonJSON output
journalctl -o json-prettyPretty JSON
journalctl -o catMessage text only
journalctl -o short-unixUNIX epoch timestamps

User Journal

Work with per-user logs.

CommandDescription
journalctl --userCurrent user journal
journalctl --user -u pipewireUser unit logs
journalctl --user -bUser logs for current boot
journalctl --user -fFollow user logs

Search and extract relevant log lines.

CommandDescription
journalctl -g "failed"Filter messages by pattern
journalctl -u nginx -g "timeout"Pattern search within a unit
journalctl -u ssh --since "1 day ago" -g "invalid user"Time + unit + pattern
journalctl -u nginx -n 200 | grep -i upstreamPipe to grep for advanced matching

Export and Integration

Export logs for analysis or scripts.

CommandDescription
journalctl -u nginx -o json-pretty > nginx.jsonExport unit logs as JSON
journalctl --since "today" --no-pager > today.logExport current day logs
journalctl -u mysql -n 300 -o catMessage-only output for quick review
journalctl -u nginx --since "1 hour ago" | lessSend filtered logs to pager

Disk Usage and Cleanup

Check size and vacuum old logs.

CommandDescription
journalctl --disk-usageShow journal size
journalctl --vacuum-size=1GLimit journal to 1 GB
journalctl --vacuum-time=7dKeep logs for 7 days
journalctl --vacuum-files=10Keep last 10 journal files
journalctl --rotateRotate journal files now
journalctl --verifyVerify journal file integrity

Use these articles for deeper troubleshooting workflows.

GuideDescription
systemctl list command in LinuxList systemd units and unit files before drilling into logs
How to Install MySQL on Ubuntu 24.04Example of using journalctl -u mysql to validate service health