December 1, 2023

How to List All Running Services under systemd in Linux

When you boot a Linux system, a lot of background tasks are kicked in as part of the booting process, that are called services or daemons. These background tasks run without a user intervention.

In systemd-based distributions, systemd is the first process that starts after the system boots and has a PID of ‘1’. Details of the services are stored in unit files located in the "/usr/lib/systemd" directory.

You can use the systemctl command to control/manage systemd units and commonly used options are to start, stop, restart, mask or reload a daemon or service.

As a Linux system administrator, you may handle many services every day. In this quick article, we will describe how to list all services running under systemd on Linux.

1) Listing Linux Services with systemctl

To see all running services on a Linux system with systemd, use the following command. This will show you each active service’s/Unit’s name, load, sub-state, and description about the running unit.

systemctl list-units --type=service --state=running
Listing Linux Services with systemctl

1.1) Listing other Unit Types

Similarly, you can see other unit types available as shown below. However, first we need to identify the list of supported units through systemctl command with the '-t' option.

# systemctl -t help

Available unit types:

You can list all supported unit types by changing '--type=[UNIT_NAME]' based on your requirement. For example, to list the ‘socket’ unit type, run:

# systemctl list-units --type=socket --state=running

If you want to check all running units at once with systemctl command, add all unit types in curly brackets as shown below:

# systemctl list-units --type={service,mount,swap,socket,target,device,automount,timer,path,slice,scope} --state=running

1.2) Checking all Running Units with systemctl

You can list all running units by filtering the 'running' string with the help of the grep command. The following command lists all types of running units including .service, .target, .socket, .mount, etc.

# systemctl | grep -i running

  proc-sys-fs-binfmt_misc.automount              loaded active running   Arbitrary Executable File Formats File System Automount Point
  acpid.path                                     loaded active running   ACPI Events Check
  cups.path                                      loaded active running   CUPS Scheduler
  init.scope                                     loaded active running   System and Service Manager
  session-2.scope                                loaded active running   Session 2 of User linuxgeek
  accounts-daemon.service                        loaded active running   Accounts Service
  acpid.service                                  loaded active running   ACPI event daemon
  avahi-daemon.service                           loaded active running   Avahi mDNS/DNS-SD Stack
  bluetooth.service                              loaded active running   Bluetooth service
  colord.service                                 loaded active running   Manage, Install and Generate Color Profiles

To count all running units, execute: As per the below output, totally 51 units are running on my system. This running service count may vary for you because it depends on the list of packages installed on the system.

# systemctl | grep -i running | wc -l

1.3) Filtering a Specific Service

Use the following command to check if a particular service is loaded and running. For example, to verify that the ‘syslog’ service is loaded and running, run: Similarly, you can check any service you want to list.

# systemctl list-units --type=service --state=running | grep -i syslog

  rsyslog.service               loaded active running System Logging Service

1.4) Checking Status of the Service

The following command can be used to view detailed information about a particular running service. It will display a lot of information like running and loaded status, enabled or not at startup, service unit location, PID of the process, how long the process has been running, memory and CPU usage, etc,.

# systemctl status rsyslog

● rsyslog.service - System Logging Service
     Loaded: loaded (/lib/systemd/system/rsyslog.service; enabled; vendor preset: enabled)
     Active: active (running) since Sat 2023-07-15 22:34:47 IST; 2h 2min ago
TriggeredBy: ● syslog.socket
       Docs: man:rsyslogd(8)
   Main PID: 824 (rsyslogd)
      Tasks: 4 (limit: 18893)
     Memory: 4.1M
        CPU: 184ms
     CGroup: /system.slice/rsyslog.service
             └─824 /usr/sbin/rsyslogd -n -iNONE

Jul 15 22:34:47 linuxgeek systemd[1]: Starting System Logging Service...
Jul 15 22:34:47 linuxgeek rsyslogd[824]: imuxsock: Acquired UNIX socket '/run/systemd/journal/syslog' (fd 3) from systemd.  [v8.2112.0]
Jul 15 22:34:47 linuxgeek rsyslogd[824]: rsyslogd's groupid changed to 110
Jul 15 22:34:47 linuxgeek rsyslogd[824]: rsyslogd's userid changed to 104
Jul 15 22:34:47 linuxgeek rsyslogd[824]: [origin software="rsyslogd" swVersion="8.2112.0" x-pid="824" x-info=""] start
Jul 15 22:34:47 linuxgeek systemd[1]: Started System Logging Service.
Jul 16 00:00:02 linuxgeek systemd[1]: rsyslog.service: Sent signal SIGHUP to main process 824 (rsyslogd) on client request.
Jul 16 00:10:02 linuxgeek rsyslogd[824]: [origin software="rsyslogd" swVersion="8.2112.0" x-pid="824" x-info=""] rsyslogd was HUPed


This article showed you how to use the systemctl commands to list all running services on Linux, including various options that show more information about a running service.

Leave a Reply

%d bloggers like this: