🧰 Systemd Service Management Cheat Sheet
A quick reference for managing and troubleshooting services with systemctl
and journalctl
.
Action |
Command |
Start a service |
sudo systemctl start <service>.service |
Stop a service |
sudo systemctl stop <service>.service |
Restart a service |
sudo systemctl restart <service>.service |
Reload service config |
sudo systemctl reload <service>.service |
Enable at boot |
sudo systemctl enable <service>.service |
Disable at boot |
sudo systemctl disable <service>.service |
Check service status |
systemctl status <service>.service |
Action |
Command |
Show all loaded services |
systemctl list-units --type=service |
Show all services (incl. inactive) |
systemctl list-units --type=service --all |
Show enabled/disabled service files |
systemctl list-unit-files --type=service |
Show failed services |
systemctl --failed |
📜 Viewing Logs (journalctl
)
Action |
Command |
Show logs for a service |
journalctl -u <service>.service |
Show last 50 log lines |
journalctl -u <service>.service -n 50 |
Follow logs live |
journalctl -u <service>.service -f |
Logs since last boot |
journalctl -u <service>.service -b |
View recent logs with errors |
journalctl -xe |
✅ Tip: You can tab-complete service names with <Tab>
after typing part of the name with systemctl
or journalctl
.