1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-04-29 23:24:55 +02:00
tldr/pages/linux/journalctl.md

37 lines
1 KiB
Markdown
Raw Normal View History

2014-02-25 10:13:55 +08:00
# journalctl
> Query the systemd journal.
> More information: <https://manned.org/journalctl>.
2014-02-25 10:13:55 +08:00
- Show all messages with priority level 3 (errors) from this boot:
2014-02-25 10:13:55 +08:00
`journalctl {{[-b|--boot]}} {{[-p|--priority]}} 3`
2014-02-25 10:13:55 +08:00
- Delete journal logs which are older than 2 days:
`journalctl --vacuum-time 2d`
- Show only the last N lines and follow new messages (like `tail -f` for traditional syslog):
2014-02-25 10:13:55 +08:00
`journalctl {{[-n|--lines]}} {{N}} {{[-f|--follow]}}`
2014-02-25 10:13:55 +08:00
- Show all messages by a specific unit:
2014-02-25 10:13:55 +08:00
`journalctl {{[-u|--unit]}} {{unit}}`
2014-02-25 10:13:55 +08:00
- Show logs for a given unit since the last time it started:
`journalctl _SYSTEMD_INVOCATION_ID=$(systemctl show --value --property=InvocationID {{unit}})`
- Filter messages within a time range (either timestamp or placeholders like "yesterday"):
`journalctl {{[-S|--since]}} {{now|today|yesterday|tomorrow}} {{[-U|--until]}} "{{YYYY-MM-DD HH:MM:SS}}"`
- Show all messages by a specific process:
2014-02-25 10:13:55 +08:00
`journalctl _PID={{pid}}`
- Show all messages by a specific executable:
2014-02-25 10:13:55 +08:00
`journalctl {{path/to/executable}}`