navigation

How to use Systemctl to list all Linux services

When administering a Linux system, it is important to understand how to control and monitor system services. Systemd, the system and service manager for most Linux distributions, provides a powerful set of tools for this purpose. Today's article will dive into how you can list all the services running in systemd, focusing on the Ubuntu terminal as an example.

What is Systemd?

Systemd is an init system used to start user space and manage system processes after boot. It is now used by most major Linux distributions. It replaces the old SysVinit system and has become the standard for service management in Linux.

Check the status of services

To start, the main command to interact with systemd is systemctl. Let's see how we can use systemctl to list all running services.

List running services using systemctl

You can list all running systemd services with the following command:

systemctl list-units --type=service --state=running

When you run this command in Ubuntu terminal, it will display a list of all running services. The output might look like this:

UNIT LOAD ACTIVE SUB DESCRIPTION ● atd.service loaded active running Deferred execution scheduler avahi-daemon.service loaded active running Avahi mDNS/DNS-SD Stack cron.service loaded active running Regular background program processing daemon dbus.service loaded active running D-Bus System Message Bus networking.service loaded active running Raise network interfaces ssh.service loaded active running OpenBSD Secure Shell server

 

This output shows several columns:

  1. UNIT: Name of the service.
  2. LOAD: Indicates whether the service configuration file has been loaded successfully or not.
  3. ACTIVE: High level activation state.
  4. SUB: Low level activation state.
  5. DESCRIPTION: A brief description of the service.

The default output is quite useful, but sometimes a bit overwhelming. If you prefer a simpler view, you can customize the output with the --no-pager option to prevent output from being sent through the paging engine, and grep to filter through services. For example:

systemctl list-units --type=service --state=running --no-pager | grep ssh

This command will only show ssh related services, which is handy if you are specifically interested in the status of SSH related services .

How to handle services that are not running

It is also important to know how to find services that are not running. For example, to see which services have failed, you can use:

systemctl --failed

This command will list services that are not loading or not starting. Here is how the output might appear:

 UNIT LOAD ACTIVE SUB DESCRIPTION ● nginx.service loaded failed failed A high performance web server ● mysql.service loaded failed failed MySQL Community Server

This is especially useful for troubleshooting as it highlights services that need attention.

Additional Tips and Tricks

Filter the list

Systemd provides several ways to filter and view specific types of services. For example, you can use the --all flag to list all services regardless of their state, or specify a specific service by its exact name for detailed state information:

systemctl status ssh.service

Enjoy control

If you like to tweak and have granular control over what is running on your system, you will appreciate the capabilities of systemd. The tools that systemd provides are powerful and flexible, allowing for the granular management of service state that is essential for any system administrator.

How to list all services, whether running or not?

 

You can list all installed services, whether running or not, using the following command:

systemctl list-units --type=service --all

This command displays every service installed on your system, including those that are not currently running.

How to start or stop a service?

To start a service, use:

sudo systemctl start [service-name].service

To stop a service, use:

sudo systemctl stop [service-name].service

Replace [service-name] with the name of the service you want to control.

How to enable a service to start on boot?

To ensure the service runs automatically on startup, use:

sudo systemctl enable [service-name].service

This command creates a symbolic link from the system's copy of the service file (usually located in /etc/systemd/system/ or /lib/systemd/system/ ) to the location where systemd looks for files that run automatically at boot.

Which command to check the status of a specific service?

To check the status of a specific service, you can use:

systemctl status [service-name].service

This command provides detailed information about the service, including current state, most recent logs, and configuration.

How to reload a service after changing its configuration?

After modifying the service's configuration, you can reload the service to apply these changes using:

sudo systemctl reload [service-name].service

This command tells the service to reload its configuration files without completely stopping and restarting the service.

Is there a way to view the logs of a specific service?

Yes, to view the logs for a specific service, you can use the journalctl command:

journalctl -u [service-name].service

This command will display log entries for the specified service. Adding -f will monitor the log, displaying new entries as they appear.

Can you list services by their load state or running state?
Absolutely! You can filter services based on their load state or running state using:

systemctl list-units --type=service --state=loaded

or

systemctl list-units --type=service --state=active

These commands help you narrow down the list to services that are loaded into the system or are currently running.

Mastering how to list and manage services with systemd is an important skill for anyone using Linux. We've explored how to check the status of services, how to start, stop, and manage them, and how to ensure they're working as expected using commands like systemctl. Whether you're troubleshooting, tweaking your system, or just curious about what's running under the hood, the tools provided by systemd provide a comprehensive and powerful way to keep your Linux system organized and running efficiently.

Update 25 May 2025