System Administration

journalctl

Query and view logs generated by the systemd-journald logging service.

COMMAND SYNTAX
$ journalctl [options] [MATCH...]

Common Options & Flags

Option / FlagDescription
-u, --unit=UNITShow logs for specified systemd unit
-f, --followFollow log output in real-time (like tail -f)
-n, --lines=NNumber of journal entries to show
-p, --priority=PRIOFilter by log priority (err, warning, info)
--since="YYYY-MM-DD HH:MM:SS"Show entries starting from specified date/time

Practical Command Examples

$ journalctl -u nginx -f

Tail real-time Nginx system logs.

$ journalctl -u docker -n 100 --no-pager

Show last 100 log lines of Docker daemon without paging.

$ journalctl -p err -b

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.