List of all services and their status:
service --status-all
Another way:
systemctl list-units --type service --all
List just the enabled services
systemctl list-units --type service
or systemctl -l –type service –all
Stop/Start/Restart a service
systemctl restart/start yourservicename
Enable/Disable the startup of a service at boot time
systemctl enable/disable yourservicename
Is it enabled?
systemctl is-enabled yourservicename
Uninstall/wipe a service
rm /etc/systemd/system/yourservicename
systemctl daemon-reload
systemctl reset-failed
Find out the dependencies:
systemctl list-dependencies --type service
Get the files related to the service:
locate yourservicename.service
Disable the service and forbids the others from start it
systemctl mask yourservicename
list systemd unit files and their states (enabled/disabled/etc)
systemctl list-unit-files
To see / set the default runlevel of the system
systemctl get-defaults (set-defaults)
e.g. multi-user.target or graphical.target
systemctl isolate
explained: (stolen from internet)
The word "isolate" means run the requested unit, and make sure
nothing else is running (with a few exceptions.) Since runlevels have been replaced by targets (which are more or less
just a set of services that you want to be running in a certain
situation, like for
multi-user
or
graphical
usage), you can switch to a "runlevel" by starting the equivalent target
and stopping anything that is not part of the new target - using
isolate
.
systemctl isolate multi-user.target
is the modern way to unload the graphic shell, which was done by
init 3
previously. You are in runlevel 5 or to be precise in graphical.target. You do runlevel 3 or systemctl isolate multiuser.target.
Another way to change target runlevel.
systemctl set-default multi-user.target (then reboot)