How can I list all enabled
services from systemctl
?
I know running systemctl
command by itself lists all services, but I would like to only get the enabled
ones.
How can I list all enabled
services from systemctl
?
I know running systemctl
command by itself lists all services, but I would like to only get the enabled
ones.
systemctl list-unit-files | grep enabled
will list all enabled ones.If you want which ones are currently running, you need
systemctl | grep running
.Use the one you're looking for. Enabled, doesn't mean it's running. And running doesn't mean it's enabled. They are two different things.
Enabled means the system will run the service on the next boot. So if you enable a service, you still need to manually start it, or reboot and it will start.
Running means it's actually running right now, but if it's not enabled, it won't restart when you reboot.
man systemctl
states:Explanation:
LOAD
: Reflects whether the unit definition was properly loaded.ACTIVE
: The high-level unit activation state, i.e. generalization ofSUB
.SUB
: The low-level unit activation state, values depend on unit type.Though you can also use this to only show
enabled
units with:If a unit is
enabled
that means that the system will start it on startup. Though setting something toenabled
doesn't actually alsostart
it so you will need to do that manually, or reboot the system after setting it toenabled
.To list all the
systemd
service which are instate=active
andsub=running
To list all the
systemd
serice which are instate=active
and sub either running or exitedTo see 'enabled' services including these that are still under upstart/init run:
To see all of the currently running services run:
Also overview of all active and failed services:
There is a good GUI application called Stacer where you can manage all the services.
Check its Github link Stacer Github
Also check Web for more info
In addition to the current answers, I use the following to get just the names of the services:
Rather than the tabular format, this makes it easier to pipe just those services to another program
What about systemctl unit templates?
To list also templated units, you might want to use:
systemctl list-units --all|grep yourservice
The
--all
switch shows also all units which have been instantiated withsystemctl <service_name>@<argument>.service
From the man page:
Example:
systemctl openvpn@my_office_endopoint.service
Further reading: https://fedoramagazine.org/systemd-template-unit-files/