What this is
journalctl reads the systemd journal (system logs) on modern Linux servers.
What it is for
- Troubleshoot failed services
- See recent errors and warnings
- Follow logs live while restarting services
Prerequisites
- SSH access
- Often needs sudo to see all logs
Step-by-step
View recent system logs
sudo journalctl -n 100 --no-pager
Filter by service (example: nginx)
sudo journalctl -u nginx -n 100 --no-pager
Follow logs live
sudo journalctl -u nginx -f
How to stop: Ctrl+C
Logs since boot
sudo journalctl -b --no-pager
Search for errors
sudo journalctl -p err -n 100 --no-pager
Final verification
Restart a service and watch logs:
sudo systemctl restart nginx
sudo journalctl -u nginx -n 30 --no-pager
Conclusion
journalctl is one of the fastest ways to understand why a service failed on a systemd server.