Ubuntu uses the systemd service manager, which acts as an init system. It runs as the first process on startup (PID 1) and is responsible for starting and maintaining other services.
systemd uses a dependency system called ‘units’. Service units specifically, are responsible for managing daemons and the processes that they’re made of.
systemd is managed using the systemctl utility. We’ll explain how you can use systemctl and service units to list various services in this article.
List Services with systemctl
-l options list units that systemd currently has in memory. The same behavior is assumed seen if you run systemctl without any options. This will list units that are active, have pending jobs, or have failed. Also, specify the unit type as service to only list services.
systemctl list-units --type=service
Here’s how you can interpret the output:
- UNIT: The systemd unit name
- LOAD: Defines whether the unit’s config has been loaded by systemd
- ACTIVE: High-level unit activation state (basically a summary)
- SUB: Low-level unit activation state (more details)
- DESCRIPTION: Unit description
List All systemd Services
If you pass the
--all option, that’ll show all services that were loaded at boot, regardless of their current state.
systemctl list-units --type service --all
list-units command only displays units that systemd has tried to load. Certain units that systemd doesn’t think necessary won’t be included in this list as they haven’t been loaded. To see every available unit file, use the following command instead:
In niche cases, you might even need to list systemd services on a system that’s not online. In such cases, you can specify the root directory like so
systemctl --root=/path/to/root list-unit-files
List Services by Startup Order
By default, systemctl lists services in alphabetical order. If you want to sort them in the order they were loaded instead, you can use the
You can redirect the output to a text file like so
systemd-analyze dump > SystemdDump.txt
Or, if you prefer a graphical format, you could use
systemd-analyze plot > SystemdPlot.svg
List Services by Status
A service’s activation state can be
dead. This is a common way to filter the output and find certain types of services.
systemctl list-units --state=failed