journalctl
Query and view logs generated by the systemd-journald logging service.
Common Options & Flags
| Option / Flag | Description |
|---|---|
| -u, --unit=UNIT | Show logs for specified systemd unit |
| -f, --follow | Follow log output in real-time (like tail -f) |
| -n, --lines=N | Number of journal entries to show |
| -p, --priority=PRIO | Filter by log priority (err, warning, info) |
| --since="YYYY-MM-DD HH:MM:SS" | Show entries starting from specified date/time |
Practical Command Examples
Tail real-time Nginx system logs.
Show last 100 log lines of Docker daemon without paging.
View all system error logs since current boot.
Production Real-World Use Case
Debugging server startup failures, crashed daemons, and system events.
Common Mistakes
- ✕Running without sudo privileges, which truncates system-level log messages.
Security Considerations
Review journal logs regularly for brute-force SSH login attempts.