📊 Viewing Service Status and Logs
Think of this as checking on your restaurant staff: You want to know if the chef is cooking, resting, or having issues. Systemd provides tools to see service health and logs.
Checking Service Status
This command shows:
- Whether the service is active (running) or inactive (stopped)
- PID (process ID) of the service
- Recent logs from the service
- Enable/disable status (whether it starts on boot)
Viewing Logs with journalctl
This command shows a full history of messages from that service, useful for troubleshooting if something went wrong.
Common flags:
-f → follow logs live (like tail -f)
--since today → logs since today
Quick Reference Table
| Task | Command | Example | Analogy |
|---|---|---|---|
| Check service status | systemctl status | nginx | Peek into the kitchen |
| View full logs | journalctl -u | nginx | Read chef's diary |
| Follow logs live | journalctl -u | nginx -f | Watch chef cook in real-time |
| Logs since today | journalctl -u | nginx --since today | Check chef's activity today |
Pro Tip
Combining status + follow logs is powerful:
First check if the chef is in the kitchen, then watch them work live to see if anything goes wrong.
Real-life analogy
For status: You peek into the kitchen and see: "The chef is cooking, started at 9:00 AM, and no problems so far." For logs: You check the chef's diary: "What did they do all day, any mistakes, any special orders?" That's a full walkthrough of Services and Systemd! You now know: 1. What systemd is and why it replaced init; 2. How to start, stop, and restart services; 3. How to enable/disable services on boot; 4. How to check status and logs.