Systemctl
Managing services with systemctl
| Action | Command |
|---|
| List services | systemctl list-units --type service |
| Query SERVICE status | sudo systemctl status SERVICE.service |
| List failed services on boot | sudo systemctl --failed |
| Start SERVICE | sudo systemctl start SERVICE.service |
| Stop SERVICE | sudo systemctl stop SERVICE.service |
| Restart SERVICE | sudo systemctl restart SERVICE.service |
| Kill SERVICE (all processes) with SIGTERM | sudo systemctl kill SERVICE.service |
| Kill SERVICE (all processes) with SIGKILL | sudo systemctl kill -s SIGKILL SERVICE.service |
| Start SERVICE on boot | sudo systemctl enable SERVICE.service |
| Don’t start SERVICE on boot | sudo systemctl disable SERVICE.service |
Runlevels
Run with root privileges (sudo)
| Action | Command |
|---|
| Go to single user mode | systemctl rescue |
| Go to multi-user mode | systemctl isolate multi-user.target |
| (= old runlevel 3) | systemctl isolate runlevel3.target |
| Go to graphical level | systemctl isolate graphical.target |
| Get default runlevel | systemctl get-default |
| Set default runlevel | systemctl set-default graphical.target |
| Shutdown | systemctl poweroff |
| Reboot, suspend, hibernate | systemctl STATE |
Resources