Cheat Sheet

journalctl Commands

journalctl reads the systemd journal, where every service on a modern Linux box writes its logs. This sheet covers the journalctl commands for filtering by service, time and priority, following live output, exporting to a file, and keeping the journal's disk usage in check.

Last updated September 11, 2026

Any user can read their own logs; reading the full system journal needs or membership in the or group. Filters combine, so is one valid command.

Service Logs

CommandWhat it does
Every log line from the nginx unit, oldest first
Open the pager at the end, newest lines on screen
Two units interleaved in time order (repeat for more)
Units matching a pattern
Jump to the end with catalog explanations, what tells you to run after a failure
A user service, no sudo needed
Follow kubelet on a Kubernetes node, the first stop when a node goes NotReady
The whole journal, every unit and the kernel

shows nothing for a misspelled unit name rather than erroring; confirm the name with from the systemctl cheat sheet.

Follow and Tail

CommandWhat it does
Follow live, like (Ctrl+C stops)
Last 100 lines ( alone means 10)
Same, straight to the terminal for copy-paste
Follow but start empty, only new lines
Newest first
Follow everything, all units at once

Time Ranges

and take human phrases and absolute stamps, and stack with every other filter.

CommandWhat it does
The last hour
Since midnight ( covers all of yesterday)
Since midnight at the start of that date
A precise window
The last 30 minutes, shorthand
Exclude the most recent lines
Interpret and print times in UTC instead of local

Boots

Crash forensics live here: limits output to one boot, counted backwards from the current one.

CommandWhat it does
Only the current boot
The previous boot, the one that crashed or was rebooted away
Every boot the journal knows, with index and time span
End of the previous boot, the last thing logged before it went down
Everything at error level or worse from the previous boot
Kernel messages from the previous boot (OOM kills, panics, disk errors)

After an unexplained reboot, this sequence usually finds the cause:

journalctl --list-boots
journalctl -b -1 -e
journalctl -b -1 -p err -o short-iso
journalctl -b -1 -k -g "oom|panic|error"

If shows only one boot, the journal is volatile and pre-reboot logs are gone; see the persistence setup under Disk Usage below.

Priority

CommandWhat it does
Priority and worse
One unit, and worse
Only a range of levels
Numbers work too (3 is )
LevelNameTypical meaning
0System is unusable
1Act immediately
2Critical condition
3Error
4Something to look at
5Normal but notable
6Routine
7Debug detail

means 0 through 3, not just 3: a priority flag always includes everything worse than the level named.

Search and Filter

CommandWhat it does
Grep the messages (PCRE; case-insensitive when the pattern is all lowercase)
Grep within one unit
Kernel messages only, the equivalent with timestamps and history
Everything logged by one process ID
Everything logged by one user's processes
Everything logged by one executable
Same idea, matched by process name
Plain grep still works when is missing (systemd older than 239)
List every unit that has logged, when you cannot recall the unit name
List the field names available to filter on

Field filters like combine with , and time flags like any other filter. shows every field a journal entry carries, which is how you discover what to filter on.

Auth and Logins

The SSH unit is on Debian and Ubuntu, on RHEL and its relatives.

CommandWhat it does
Failed SSH password attempts, with source IP
Successful logins, with user, IP and auth method
Today's probes for accounts that do not exist
The whole authpriv facility, the equivalent
Who ran today, and what they ran
Watch fail2ban bans and unbans live
Count failed attempts this boot

A busy public host logs thousands of failed SSH attempts a day, which is noise rather than a break-in. Look for an line from an IP you do not recognise.

User Services

reads the journal of your own systemd user manager. Without it you get the system journal, where user units do not appear.

CommandWhat it does
Everything your own user services logged, no sudo needed
One user unit
Follow a user unit live
Errors from your user services this boot
Another user's user unit, read as root
Everything one user's processes logged today

shows root's user journal, not yours, which is a common five-minute detour.

Output Formats

CommandWhat it does
ISO 8601 timestamps, sortable and unambiguous
Microsecond timestamps
One JSON object per line, for and log shippers
Readable JSON, one entry at a time
Message text only, no timestamps or hostnames
Full weekday and date, the style stamp
Drop the hostname column on a single-host box
Pick the fields to print
Print times in UTC
Append the cursor of the last entry shown
Resume from a saved cursor
Read the cursor from a file and update it after, for polling scripts

Cursors give a script an exact resume point, so a cron job can process only what arrived since its last run without overlaps or gaps.

Pager and Wrapping

Output goes through , started with . The in there chops long lines at the terminal width, which is why lines look cut off.

Command or keyWhat it does
Quit the pager and get the prompt back
/ Jump to the end / back to the start
then Search forward inside the pager, then next match
then EnterToggle line chopping on and off from inside
Wrap long lines instead of chopping them, for one run
Print straight to the terminal, for pipes and scripts
Ellipsize fields too wide for the terminal ( is the default)
No colour codes, for logs you are about to paste somewhere

Set in your shell profile to skip the pager permanently. never uses the pager, so Ctrl+C is what ends a follow.

Export to a File

The pager is skipped automatically when output is not a terminal, so a plain redirect needs no .

CommandWhat it does
Plain text dump of one unit
Previous boot with sortable timestamps, for a ticket
JSON lines for or a log shipper
Native export format, every field preserved
Read specific journal files
Read a journal directory from a mounted disk or rescue boot
Interleave every journal found, including other users and boots
Read a container or nspawn machine's journal from the host

Disk Usage and Vacuum

CommandWhat it does
Total space the journal takes on disk
Delete oldest archived files until under 500 MB
Delete everything older than two weeks
Keep only the five newest journal files
Archive the active file so vacuum can reach it
Check journal files for corruption

Vacuum only removes archived files, so first when you need space back now. To cap size permanently and keep logs across reboots, set both in :

[Journal]
Storage=persistent
SystemMaxUse=500M
sudo mkdir -p /var/log/journal
sudo systemctl restart systemd-journald

The edge case that bites: the default persists only if already exists. Debian and Ubuntu ship the directory, so their logs survive reboots; RHEL and CentOS generally do not, so every boot starts the journal empty and has nothing to show until you create it.

Gotchas

  • Empty output from usually means a misspelled or different unit name, not missing logs. settles it.
  • erroring with no persistent journal means the logs you want are already gone. Set up persistence today, before the crash you will want to debug.
  • shows and everything worse, and it filters on the priority the service declared. Apps that write plain text to stdout log everything at , so their errors do not surface under ; use for those.
  • Timestamps print in the machine's local timezone. On servers set to UTC that is what you expect; on anything else, avoids an hour of confusion during incident timelines.
  • needs systemd 239 or newer. Older hosts (CentOS 7 and friends) pipe to instead.
  • There is no exclude flag. journalctl matches are positive only, so to drop one noisy unit you either name the units you do want with repeated , or pipe through .
  • Searching with reads every entry, while and other field matches use the journal index. Narrow by boot or time first and the same search finishes far quicker.
  • Without you see your own logs only, and journalctl says so in a hint at the top that is easy to scroll past. Add yourself to for read access without sudo.
  • The journal and a service's own log files are separate worlds. nginx access logs live in , not the journal; the journal has stdout, stderr and what systemd itself says about the unit. Unit state is the same split: lists what is broken, journalctl only shows what it logged. The systemctl cheat sheet covers the service side.

journalctl FAQ

Where does journalctl store its logs?

In binary files under /var/log/journal/<machine-id>/ when the journal is persistent, and in /run/log/journal/ when it is not, which is memory and disappears at every reboot. The files are not text, so cat, tail and grep on them give you nothing useful; journalctl is the reader. Each user's services get their own user-1000.journal alongside system.journal in the same directory. You can also point journalctl at files it did not open itself: journalctl --file /var/log/journal/*/system.journal reads specific files, and journalctl -D /mnt/old/var/log/journal reads a whole journal directory from a mounted disk or a rescue boot, which is how you read the logs of a machine that no longer starts.

How do I exit journalctl?

Press q. journalctl pipes output through less, so the prompt does not come back until the pager exits, and Ctrl+C there usually does nothing visible. Inside the pager, g jumps to the start, G to the end, /word searches forward and n repeats it. A live follow is the exception: -f skips the pager, so Ctrl+C is what stops it. To avoid the pager entirely, add --no-pager, or set SYSTEMD_PAGER=cat in your shell profile to make every journalctl run print straight to the terminal.

Why is journalctl so slow?

Usually because the filter cannot use the journal's index. Field matches like -u, _PID= and _COMM= are indexed and stay quick on a large journal, while -g and a pipe into grep read every entry, and -r or -e have to walk to the far end before printing anything. Narrow first and search second: journalctl -b --since "1 hour ago" -g timeout finishes in a fraction of the time journalctl -g timeout takes. Check the size with journalctl --disk-usage, since a journal that has grown to several GB is worth vacuuming, and run journalctl --verify to rule out the corrupt files that make reads crawl.

Do I need sudo to run journalctl?

Only for other people's logs. Any user can read their own messages and their own user services; the full system journal needs root or membership in systemd-journal, and most distributions also give the adm and wheel groups read access through an ACL on /var/log/journal. sudo usermod -aG adm alice fixes it for good, but group changes only apply to a new login session, so log out and back in before deciding it failed. Two traps: journalctl prints a single-line hint when it is hiding entries from you and it scrolls past easily, and sudo journalctl --user shows root's user journal rather than yours.

How do I clear journalctl logs?

Vacuum it, do not delete it. Run sudo journalctl --rotate to archive the file currently being written, then sudo journalctl --vacuum-size=500M or sudo journalctl --vacuum-time=2weeks to remove the oldest archived files until the limit is met; it prints every file it deletes. Skipping the rotate step is why a vacuum often frees far less than expected, because the active file is never touched. Sizes take K, M and G suffixes. There is no way to clear the lines of a single service. To stop the journal growing back, set SystemMaxUse=500M in /etc/systemd/journald.conf; the default is 10% of the filesystem, capped at 4G.

Related cheat sheets