List Services with systemctl on Linux

How to List Services with systemctl on Linux

In this article, we will look at how to list services with the systemctl command on Linux to manage the background tasks. So, let’s get started.

Services and Daemons – A Quick Intro

The Linux machines rely on background tasks called services. You can also view these services and identify which services are running, disabled, or failed. Services and daemons are background tasks that run when the computer boots up. They do not require a Graphical User Interface (GUI) to run, nor do they require any human interaction. 

Initially, there was an init process that would run all the processes. All the process details were stored in the “/etc/init/d” directory. However, in systemd configurations, systemd is the first process to start and launch all the services. Its details are saved in the location “usr/lib/systemd”. The systemd details are also kept on its manual page. To view its man page, type:

man systemd


list services with systemctl

You will see that there are several system commands to inspect and control different system services. In this article, we will take a closer look at the systemctl command. 


For this guide, make sure to have a root account or sudo privileges. Also, ensure that you are running a systemd-based distribution. Almost all Linux distributions are systemd based, which includes Arch, Red Hat, and Debian. To confirm that your system is systemd-based distribution, type:

pstree | head -5


pstree command

From the output, it is clear that the first process to run after boot is systemd. Hence, the system is systemd-based.

How to List Services with the Systemctl on Linux

To list services and daemons on the terminal, we use the systemctl command. The general syntax of the command looks something like this:

systemctl [ OPTIONS… ] COMMAND [UNIT…]

List All Running Services with the Systemctl Command

We can modify the systemctl command with different types of state options. For instance, to view the services that are currently running, use the –state=running option. Specifically, type:

systemctl --type=service --state=running

The output looks something like this:

list services with systemcd

To view further information, navigate using the right and left arrow keys. As you can see, the output is very wide for the terminal window, so you can use the Less file viewer to view the output. Modify the command as shown below:

systemctl --type=service --state=running | less

Press “q” to exit from the less file viewer. 

The systemctl command generates the following information about the processes:

  • Unit: The name of the service or daemon. 
  • Load: The load state of the service or daemon. The usual load states are loaded, not-found, bad-setting, error, or masked.
  • Active: The overall state the service or daemon is in. It can be active, reloading, inactive, failed, activating, or deactivating.
  • SUB: The sub-state of the service or daemon. The sub-states consist of the dead, exit, failed, inactive, or running.
  • Description: A short description of the service currently running.

List a Particular Running Service with Systemctl Command

Alternatively, you can also view a single detail about the currently running process. For this step, use the grep command. To elaborate further, pipe the output to the grep command from the systemctl command. For example, to isolate the ssh service information, type:

systemctl --type=service --state=running | grep ssh

You should get a similar output:

View ssh service

Alternatively, you can remove the type and state to view all the information related to the ssh unit. For this example, type:

systemctl status sshd

You should get a similar output:

View ssh unit

This will not only include services but ss daemons as well. The output generates the following information:

  • The name of the service.
  • A color-coded dot shows whether it is running or not.
  • Path to the unit file.
  • How long it has been running.
  • Where the documentation is located in the man manual.
  • The Process ID of the running unit.
  • The number of concurrent services.
  • The size of memory the unit is consuming.
  • Amount of CPU time consumed so far.

List Failed Services with Systemctl Command on Linux

So far, we have filtered only the running services using the systemctl command. However, we can filter services for any other sub-state as well. For instance, let’s look for the failed services:

systemctl --type=service --state=failed


list failed services using systemctl

List Multiple Sub-States with the Systemctl Command on Linux

Alternatively, you can use a combination of sub-states with the systemctl command. However, make sure to not include any white space between multiple substrates. For example, to search for the failed and exited services, type:

systemctl --type=service --state=failed,exited

The output should look something like this:

List failed and exited services using systemctl

You can pipe the same output to the less file viewer. For example:

systemctl --type=service --state=failed,exited | less

From the output, you can see that the processes in the list have either failed due to some reason or have exited from the RAM.

List Units with Systemctl Command on Linux

The systemctl command lists processes, services, and daemons that the system has launched. The combined word for these files is “unit”. You can use the systemctl command to list units as well. For instance, type:

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

Both commands would produce the same output. In addition, you can alter the systemctl command to increase the scope of the output by including the list-unit-files option. Type:

systemctl list-unit-files --state=enabled

You should get a similar output:

list enabled units

To view the units regardless of their states, remove the state option. For example:

systemctl list-unit-files

The output will contain many more entries than the results from the previous commands.

That’s all for now. In this article, we covered how to list services with the systemctl command on Linux. This command allows us to not only list services, but entire units as well. In addition, you can configure the states of the units in the systemctl to get the required output. Plus, the command also allows us to configure the unit type as well. Do you have any additions to make or questions? If yes, reach us using the comment form below.

If you liked this article, do share it.

Leave a Reply
Related Posts