System administration

Linux journalctl command

Read systemd journal entries. Use -u to filter by service unit.

Availability: Common Linux commands; shell built-ins and external implementations may differ by distribution.中文

Syntax

journalctl [OPTIONS...] [MATCHES...]

Examples

Show the last 50 SSH unit messages without a pager.

journalctl -u ssh -n 50 --no-pager

Show warning and more severe messages from this boot.

journalctl -b -p warning

Parameters, options and clauses

Option / clauseDescription
-u, --unit=UNITShow messages for a systemd unit.
-f, --followFollow new journal entries.
-b, --boot[=ID]Show entries from the current boot or a selected boot.
-n, --lines=NShow the most recent N entries.
--since=TIME / --until=TIMERestrict entries to a time range.
-p, --priority=LEVELFilter by priority and more severe levels.
--no-pagerWrite output directly instead of opening a pager.
Safety note

Review a command and its target before running it. Commands that alter files, services, accounts, disks, permissions or databases may be difficult to reverse. Test in a safe environment and keep backups.

Official reference ↗Back to directory