Skip to content

journalctl

Query and display logs from the systemd journal (https://www.freedesktop.org/software/systemd/man/latest/journalctl.html)

--- Following & Output ---

To follow logs in real time (like tail -f):

journalctl -f

To show the last N lines

journalctl -n <number>

To show output in JSON format

journalctl -o json-pretty

To show logs without a pager

journalctl --no-pager

--- Filtering by Unit ---

To filter by a specific systemd unit:

journalctl -u <unit>

To follow logs for a specific unit

journalctl -fu <unit>

To filter by multiple units

journalctl -u <unit1> -u <unit2>

To show list of all units logged in the journal

journalctl -F _SYSTEMD_UNIT

--- Filtering by Priority (0=emerg .. 7=debug) ---

To show logs at a specific priority and above:

journalctl -p <level>

To show all errors and above since last boot

journalctl -b -p err

To show only warning messages

journalctl -p warning..warning

--- Filtering by Time ---

To filter by time range:

journalctl --since="<YYYY-MM-DD HH:MM:SS>" --until="<YYYY-MM-DD HH:MM:SS>"

To show logs since yesterday

journalctl --since=yesterday

To show logs from the last hour

journalctl --since="1 hour ago"

To show logs from today

journalctl --since=today

--- Filtering by Boot ---

To list all available boots:

journalctl --list-boots

To show logs from the current boot

journalctl -b

To show logs from the previous boot

journalctl -b -1

To show logs from a specific boot by ID

journalctl -b <boot-id>

--- Filtering by Process / User ---

To filter by executable path:

journalctl /usr/bin/<executable>

To filter by PID

journalctl _PID=<pid>

To filter by command name

journalctl _COMM=<name>

To filter by user ID

journalctl _UID=<uid>

To filter by syslog identifier

journalctl -t <identifier>

--- Kernel Logs ---

To show only kernel messages (like dmesg):

journalctl -k

To show kernel messages from the previous boot

journalctl -k -b -1

--- Disk Usage & Maintenance ---

To show journal disk usage:

journalctl --disk-usage

To vacuum logs older than a given time

journalctl --vacuum-time=2weeks

To vacuum logs to keep only a maximum size

journalctl --vacuum-size=500M

To vacuum logs to keep only N files

journalctl --vacuum-files=5