journalctl commands

12 commands, each with a one-line explanation. Click a command to copy it, or its title for details.

Commands 12 shown

  • journalctl -p err -b --no-pager

    Only err/crit/alert/emerg from current boot; -p takes a range too (e.g. -p warning..err)

    debug · troubleshooting

  • journalctl _SYSTEMD_UNIT=sshd.service --since today

    Trusted unit match by indexed field, unlike -u which also pulls coredumps/PAM noise

    systemd · troubleshooting

  • journalctl _PID=1 + _COMM=sshd -o short-iso

    A bare + is a logical OR between match groups; same-field matches within a group are OR'd too

    debug · troubleshooting

  • journalctl --grep='oom|out of memory' --case-sensitive=false -b

    PCRE2 match on MESSAGE; pair with -p err to narrow noise. note: scans, not indexed

    debug · troubleshooting

  • journalctl -u <name> -o verbose -n 1

    Dumps every journal field incl. cursor for an entry; -o json-pretty for machine parsing

    debug · observability

  • journalctl --list-boots && journalctl -b -1 -p warning

    Index past boots, then -b -1 reads the prior boot. note: needs persistent storage

    kernel · troubleshooting

  • journalctl -k -b -o short-precise --grep='segfault|I/O error'

    Like dmesg but with real wall-clock and boot filtering; -k means _TRANSPORT=kernel

    kernel · disk

  • journalctl --disk-usage; journalctl --vacuum-size=500M --vacuum-time=2d

    Show on-disk size, then prune to 500M and drop entries older than 2 days

    disk · performance

  • journalctl -t kernel -t sudo -f --no-hostname

    Tail by SYSLOG_IDENTIFIER (not unit); -t repeats, --no-hostname trims clutter

    monitoring · observability

  • journalctl -u <name> --output=json --output-fields=__REALTIME_TIMESTAMP,MESSAGE,_PID | jq -r '[.__REALTIME_TIMESTAMP,._PID,.MESSAGE]|@tsv'

    Trim JSON to needed fields then tab-format; __REALTIME_TIMESTAMP is microseconds

    observability · debug

  • journalctl -D /mnt/crashed/var/log/journal -b -1 -p err

    Read journals from another root (rescue/forensics) without copying files in

    troubleshooting · disk

  • journalctl --header | grep -iE 'file|state'; ls -d /var/log/journal 2>/dev/null || echo volatile

    If /var/log/journal is absent, logs are volatile and lost on reboot. fix: mkdir + systemd-tmpfiles

    disk · troubleshooting