Linux Command: journalctl
Query and display systemd journal logs
journalctl queries and displays logs from the systemd journal. The journal captures all system logs including kernel messages, service output, and syslog messages in a structured, indexed format. journalctl provides powerful filtering by service, time range, priority, and more. It replaces reading raw log files in /var/log/ for most troubleshooting tasks. journalctl is the primary log viewer for systemd-based systems. It supports real-time following, JSON output, and persistent storage of logs.
Syntax
journalctl [OPTION]...Common Examples
journalctl -u nginx --no-pager -n 50— Shows last 50 log lines for nginx.journalctl -u myapp -f— Follows log output in real time (like tail -f).journalctl -p err -b— Shows only error-level messages from current boot.journalctl --since "2024-01-15 02:00" --until "2024-01-15 04:00"— Shows logs from a specific time window.
Pro Tips
Master this and 230+ other Linux commands with our comprehensive eBooks and cheat sheets.
Related Resources