systemctl
Updated: October 15, 2024
Systemctl is used to introspect and control the state of the “systemd”.
Control systemd system and service manager.
Table of Contents
tldr
systemctl
-s, --signal= #[SIGTERM, SIGINT OR SIGSTOP]
SIGTERM- graceful shutdown, can be ignored.
SIGINT- same as ctrl-c, process is interrupted and stopped, can be ignored.
SIGSTOP- pauses a process, cannot be ignored.
systemctl isolate (.target is assumed if no extension given)
systemctl isolate runtime0.target
sudo systemctl set-default runlevel5.target
systemctl list-units --type=target
RUNLEVELS
runlevel0.target halt/shutdown
runlevel1.target Single User Mode -networking -daemons -user logins
runlevel2.target Multi-user Mode - networking -daemons
runlevel3.target Multi-user Mode + networking
runlevel4.target Not Used
runlevel5.target level3+X11 (graphical.target)
runlevel6.target reboot
systemctl start foo.service # activate a service immediately
systemctl stop foo.service # deactivate a service immediately
systemctl restart foo.service # restart a service
systemctl status foo.service # check if service is running
systemctl enable foo.service # starts service on bootup
systemctl disable foo.service # service will not start on bootup
systemctl is-enabled foo.service; echo $? # check if service is enabled, 0 yes, 1 no
Boot to Bios
sudo systemctl reboot --firmware # linux