Technotes

Technotes for future me

Systemctl

Managing services with systemctl

ActionCommand
List servicessystemctl list-units --type service
Query SERVICE statussudo systemctl status SERVICE.service
List failed services on bootsudo systemctl --failed
Start SERVICEsudo systemctl start SERVICE.service
Stop SERVICEsudo systemctl stop SERVICE.service
Restart SERVICEsudo systemctl restart SERVICE.service
Kill SERVICE (all processes) with SIGTERMsudo systemctl kill SERVICE.service
Kill SERVICE (all processes) with SIGKILLsudo systemctl kill -s SIGKILL SERVICE.service
Start SERVICE on bootsudo systemctl enable SERVICE.service
Don’t start SERVICE on bootsudo systemctl disable SERVICE.service

Runlevels

Run with root privileges (sudo)

ActionCommand
Go to single user modesystemctl rescue
Go to multi-user modesystemctl isolate multi-user.target
(= old runlevel 3)systemctl isolate runlevel3.target
Go to graphical levelsystemctl isolate graphical.target
Get default runlevelsystemctl get-default
Set default runlevelsystemctl set-default graphical.target
Shutdownsystemctl poweroff
Reboot, suspend, hibernatesystemctl STATE

Resources

Last updated on 31 Jan 2021
Published on 28 Mar 2020
Edit on GitHub