systemctl Cheat Sheet
Use systemctl to manage Linux services, inspect failures, enable startup services and troubleshoot systemd units.
Check service status
Status
systemctl status nginxIs active?
systemctl is-active nginxIs enabled?
systemctl is-enabled nginxFailed services
systemctl --failedStart, stop and restart
| Task | Command |
|---|---|
| Start | systemctl start nginx |
| Stop | systemctl stop nginx |
| Restart | systemctl restart nginx |
| Reload config | systemctl reload nginx |
| Restart only if running | systemctl try-restart nginx |
Enable and disable startup services
Enable at boot
systemctl enable nginxDisable at boot
systemctl disable nginxEnable and start now
systemctl enable --now nginxDisable and stop now
systemctl disable --now nginxList services and units
Running services
systemctl list-units --type=serviceAll service files
systemctl list-unit-files --type=serviceLoaded units
systemctl list-unitsDependencies
systemctl list-dependencies nginxView service logs
Recent logs
journalctl -u nginx -n 100Follow logs
journalctl -u nginx -fSince one hour ago
journalctl -u nginx --since "1 hour ago"Boot logs
journalctl -b -u nginxReload units and configs
Reload systemd manager config
systemctl daemon-reloadShow unit file
systemctl cat nginxEdit override
systemctl edit nginxTroubleshooting services
| Problem | Commands |
|---|---|
| Service will not start | systemctl status servicejournalctl -u service -n 100 |
| Unit changed but not applied | systemctl daemon-reload |
| Service failed at boot | systemctl --failedjournalctl -b -p err |
systemctl troubleshooting flow
# Check service state
systemctl status nginx
# Read recent logs
journalctl -u nginx -n 80 --no-pager
# Restart safely
systemctl restart nginx
# Enable at boot
systemctl enable nginx
# Reload unit files after editing
systemctl daemon-reload
Frequently Asked Questions
What is systemctl used for?
systemctl controls and inspects systemd services, timers and units.
What is the difference between start and enable?
start runs a service now, while enable starts it automatically at boot.
How do I read service logs?
Use journalctl -u service-name.
When should I run daemon-reload?
Run it after editing or creating systemd unit files.