Cyberithub

6 Popular Methods to List All Running Services Under Systemd in Linux

In this article, I will take you through 6 Popular Methods to List All Running Services Under Systemd in Linux. If you are working or using Linux based systems from long time then you might be aware of System V which used runlevel scripts to run programs at specified Run Level. Now we have more advanced Systemd Managed Services which uses Unit, Service and targets instead of using runlevels. Systemd provides many new features over System V and upstart like it is event driven which means it can monitor and respond to any new System Events. It also provides the ability to respawn processes.

Important Systemd Terminologies

Units : Each configurable item in Systemd is a Unit File. Configuration of Unit File can be found in three places: /etc/systemd/system, /run/systemd/system and /lib/systemd/system.

Services :  It is basically a type of Unit File in Systemd which works as a daemon that can be stopped and started. This is similar to Service in System V. It’s name ends with .service.

Targets : It is also a type of Systemd Unit file which groups service dependency together. It’s name end with .target.

6 Popular Methods to List All Running Services Under Systemd in Linux 1

List All Running Services Under Systemd in Linux

Also Read: How to Install VIM Editor on Linux (RHEL / CentOS 7/8) Using 6 Easy Steps

Method 1: How to List All Units Under Systemd in Linux

If you want to List all units under Systemd in Linux then you need to simply use systemctl command as shown below.

[root@localhost ~]# systemctl            
UNIT                                                                                      LOAD  ACTIVE   SUB   DESCRIPTION
proc-sys-fs-binfmt_misc.automount                                                        loaded active running Arbitrary Executable File Formats File System Automount Point
sys-devices-pci0000:00-0000:00:01.1-ata2-host1-target1:0:0-1:0:0:0-block-sr0.device      loaded active plugged VBOX_CD-ROM list running services
sys-devices-pci0000:00-0000:00:03.0-net-enp0s3.device                                    loaded active plugged 82540EM Gigabit Ethernet Controller (PRO/1000 MT Desktop Adapter)
sys-devices-pci0000:00-0000:00:05.0-sound-card0.device                                   loaded active plugged 82801AA AC'97 Audio Controller
sys-devices-pci0000:00-0000:00:0d.0-ata3-host2-target2:0:0-2:0:0:0-block-sda-sda1.device loaded active plugged VBOX_HARDDISK 1
sys-devices-pci0000:00-0000:00:0d.0-ata3-host2-target2:0:0-2:0:0:0-block-sda-sda2.device loaded active plugged VBOX_HARDDISK 2
sys-devices-pci0000:00-0000:00:0d.0-ata3-host2-target2:0:0-2:0:0:0-block-sda.device      loaded active plugged VBOX_HARDDISK
sys-devices-pci0000:00-0000:00:0d.0-ata4-host3-target3:0:0-3:0:0:0-block-sdb-sdb1.device loaded active plugged VBOX_HARDDISK 1
sys-devices-pci0000:00-0000:00:0d.0-ata4-host3-target3:0:0-3:0:0:0-block-sdb.device      loaded active plugged VBOX_HARDDISK
sys-devices-pci0000:00-0000:00:0d.0-ata5-host4-target4:0:0-4:0:0:0-block-sdc-sdc1.device loaded active plugged VBOX_HARDDISK 1
sys-devices-pci0000:00-0000:00:0d.0-ata5-host4-target4:0:0-4:0:0:0-block-sdc.device      loaded active plugged VBOX_HARDDISK
sys-devices-platform-serial8250-tty-ttyS0.device                                         loaded active plugged /sys/devices/platform/serial8250/tty/ttyS0
sys-devices-platform-serial8250-tty-ttyS1.device                                         loaded active plugged /sys/devices/platform/serial8250/tty/ttyS1
sys-devices-platform-serial8250-tty-ttyS2.device                                         loaded active plugged /sys/devices/platform/serial8250/tty/ttyS2
sys-devices-platform-serial8250-tty-ttyS3.device                                         loaded active plugged /sys/devices/platform/serial8250/tty/ttyS3
sys-devices-virtual-block-dm\x2d0.device                                                 loaded active plugged /sys/devices/virtual/block/dm-0
sys-devices-virtual-block-dm\x2d1.device                                                 loaded active plugged /sys/devices/virtual/block/dm-1
sys-devices-virtual-net-virbr0.device                                                    loaded active plugged /sys/devices/virtual/net/virbr0
sys-devices-virtual-net-virbr0\x2dnic.device                                             loaded active plugged /sys/devices/virtual/net/virbr0-nic
sys-module-configfs.device                                                               loaded active plugged /sys/module/configfs list running services
sys-subsystem-net-devices-enp0s3.device                                                  loaded active plugged 82540EM Gigabit Ethernet Controller (PRO/1000 MT Desktop Adapter)
sys-subsystem-net-devices-virbr0.device                                                  loaded active plugged /sys/subsystem/net/devices/virbr0 list running services
sys-subsystem-net-devices-virbr0\x2dnic.device                                           loaded active plugged /sys/subsystem/net/devices/virbr0-nic list running services
-.mount                                                                                  loaded active mounted /
boot.mount                                                                               loaded active mounted /boot list running services
dev-hugepages.mount                                                                      loaded active mounted Huge Pages File System
dev-mqueue.mount                                                                         loaded active mounted POSIX Message Queue File System
proc-sys-fs-binfmt_misc.mount                                                            loaded active mounted Arbitrary Executable File Formats File System
run-user-0.mount                                                                         loaded active mounted /run/user/0 list running services
sys-kernel-config.mount                                                                  loaded active mounted Configuration File System
sys-kernel-debug.mount                                                                   loaded active mounted Debug File System list running services
var-lib-nfs-rpc_pipefs.mount                                                             loaded active mounted RPC Pipe File System list running services
systemd-ask-password-plymouth.path                                                       loaded active waiting Forward Password Requests to Plymouth Directory Watch
systemd-ask-password-wall.path                                                           loaded active waiting Forward Password Requests to Wall Directory Watch
session-1.scope                                                                          loaded active running Session 1 of user root
auditd.service                                                                           loaded active running Security Auditing Service
blk-availability.service                                                                 loaded active exited Availability of block devices

Method 2: How to List All Services Under Systemd in Linux

If you want to List All Services Under systemd in Linux then you need to use systemctl list-units --type=service command as shown below.

[root@localhost ~]# systemctl list-units --type=service
UNIT                                LOAD  ACTIVE  SUB          DESCRIPTION
auditd.service                     loaded active running Security Auditing Service
blk-availability.service           loaded active exited  Availability of block devices
chronyd.service                    loaded active running NTP client/server
crond.service                      loaded active running Command Scheduler
dbus.service                       loaded active running D-Bus System Message Bus
firewalld.service                  loaded active running firewalld - dynamic firewall daemon
getty@tty1.service                 loaded active running Getty on tty1 list running services
gssproxy.service                   loaded active running GSSAPI Proxy Daemon list running services
iscsi-shutdown.service             loaded active exited  Logout off all iSCSI sessions on shutdown
kdump.service                      loaded active exited  Crash recovery kernel arming list running services
kmod-static-nodes.service          loaded active exited  Create list of required static device nodes for the current kernel
ksm.service                        loaded active exited  Kernel Samepage Merging list running services
ksmtuned.service                   loaded active running Kernel Samepage Merging (KSM) Tuning Daemon
libvirtd.service                   loaded active running Virtualization daemon list running services
lvm2-lvmetad.service               loaded active running LVM2 metadata daemon list running services
lvm2-monitor.service               loaded active exited  Monitoring of LVM2 mirrors, snapshots etc. using dmeventd or progress polling
lvm2-pvscan@8:17.service           loaded active exited  LVM2 PV scan on device 8:17 list running services
lvm2-pvscan@8:2.service            loaded active exited  LVM2 PV scan on device 8:2 list running services
mysqld.service                     loaded active running MySQL Community Server list running services
netcf-transaction.service          loaded active exited  Rollback uncommitted netcf network config change transactions
network.service                    loaded active exited  LSB: Bring up/down networking
polkit.service                     loaded active running Authorization Manager
rhel-dmesg.service                 loaded active exited  Dump dmesg to /var/log/dmesg
rhel-domainname.service            loaded active exited  Read and set NIS domainname from /etc/sysconfig/network
rhel-import-state.service          loaded active exited  Import network configuration from initramfs
rhel-readonly.service              loaded active exited  Configure read-only root support
rpcbind.service                    loaded active running RPC bind service
rsyslog.service                    loaded active running System Logging Service
sendmail.service                   loaded active running Sendmail Mail Transport Agent
sm-client.service                  loaded active running Sendmail Mail Transport Client
sshd.service                       loaded active running OpenSSH server daemon
systemd-journal-flush.service      loaded active exited  Flush Journal to Persistent Storage
systemd-journald.service           loaded active running Journal Service
systemd-logind.service             loaded active running Login Service
systemd-random-seed.service        loaded active exited  Load/Save Random Seed
systemd-remount-fs.service         loaded active exited  Remount Root and Kernel File Systems
systemd-sysctl.service             loaded active exited  Apply Kernel Variables
systemd-tmpfiles-setup-dev.service loaded active exited  Create Static Device Nodes in /dev
systemd-tmpfiles-setup.service     loaded active exited  Create Volatile Files and Directories
systemd-udev-settle.service        loaded active exited  udev Wait for Complete Device Initialization
systemd-udev-trigger.service       loaded active exited  udev Coldplug all Devices
systemd-udevd.service              loaded active running udev Kernel Device Manager
systemd-update-utmp.service        loaded active exited  Update UTMP about System Boot/Shutdown
systemd-user-sessions.service      loaded active exited  Permit User Sessions
systemd-vconsole-setup.service     loaded active exited  Setup Virtual Console
tuned.service                      loaded active running Dynamic System Tuning Daemon
vsftpd.service                     loaded active running Vsftpd ftp daemon

LOAD = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB = The low-level unit activation state, values depend on unit type.

47 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'.

list-units: List known units (subject to limitations specified with -t). More information can be checked on Systemctl Man Page.

Method 3: How to List All Running Services Under Systemd in Linux 

If you want to List all running services under Systemd in Linux then you need to use systemctl list-units --type=service --state=running command as shown below.

[root@localhost ~]# systemctl list-units --type=service --state=running
UNIT                      LOAD  ACTIVE  SUB        DESCRIPTION
auditd.service           loaded active running Security Auditing Service
chronyd.service          loaded active running NTP client/server
crond.service            loaded active running Command Scheduler
dbus.service             loaded active running D-Bus System Message Bus
firewalld.service        loaded active running firewalld - dynamic firewall daemon
getty@tty1.service       loaded active running Getty on tty1
gssproxy.service         loaded active running GSSAPI Proxy Daemon
ksmtuned.service         loaded active running Kernel Samepage Merging (KSM) Tuning Daemon
libvirtd.service         loaded active running Virtualization daemon
lvm2-lvmetad.service     loaded active running LVM2 metadata daemon
mysqld.service           loaded active running MySQL Community Server
polkit.service           loaded active running Authorization Manager
rpcbind.service          loaded active running RPC bind service
rsyslog.service          loaded active running System Logging Service
sendmail.service         loaded active running Sendmail Mail Transport Agent
sm-client.service        loaded active running Sendmail Mail Transport Client
sshd.service             loaded active running OpenSSH server daemon
systemd-journald.service loaded active running Journal Service
systemd-logind.service   loaded active running Login Service
systemd-udevd.service    loaded active running udev Kernel Device Manager
tuned.service            loaded active running Dynamic System Tuning Daemon
vsftpd.service           loaded active running Vsftpd ftp daemon

LOAD = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB = The low-level unit activation state, values depend on unit type.

22 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'.

Method 4: How to List All Exited Services Under Systemd in Linux

If you want to List all exited services under Systemd in Linux then you need to use systemctl list-units --type=service --state=exited command as shown below.

[root@localhost ~]# systemctl list-units --type=service --state=exited
    UNIT                           LOAD   ACTIVE SUB        DESCRIPTION
blk-availability.service           loaded active exited Availability of block devices
iscsi-shutdown.service             loaded active exited Logout off all iSCSI sessions on shutdown
kdump.service                      loaded active exited Crash recovery kernel arming
kmod-static-nodes.service          loaded active exited Create list of required static device nodes for the current kernel
ksm.service                        loaded active exited Kernel Samepage Merging
lvm2-monitor.service               loaded active exited Monitoring of LVM2 mirrors, snapshots etc. using dmeventd or progress polling
lvm2-pvscan@8:17.service           loaded active exited LVM2 PV scan on device 8:17
lvm2-pvscan@8:2.service            loaded active exited LVM2 PV scan on device 8:2
netcf-transaction.service          loaded active exited Rollback uncommitted netcf network config change transactions
network.service                    loaded active exited LSB: Bring up/down networking
rhel-dmesg.service                 loaded active exited Dump dmesg to /var/log/dmesg
rhel-domainname.service            loaded active exited Read and set NIS domainname from /etc/sysconfig/network
rhel-import-state.service          loaded active exited Import network configuration from initramfs
rhel-readonly.service              loaded active exited Configure read-only root support
systemd-journal-flush.service      loaded active exited Flush Journal to Persistent Storage
systemd-random-seed.service        loaded active exited Load/Save Random Seed
systemd-remount-fs.service         loaded active exited Remount Root and Kernel File Systems
systemd-sysctl.service             loaded active exited Apply Kernel Variables
systemd-tmpfiles-setup-dev.service loaded active exited Create Static Device Nodes in /dev
systemd-tmpfiles-setup.service     loaded active exited Create Volatile Files and Directories
systemd-udev-settle.service        loaded active exited udev Wait for Complete Device Initialization
systemd-udev-trigger.service       loaded active exited udev Coldplug all Devices
systemd-update-utmp.service        loaded active exited Update UTMP about System Boot/Shutdown
systemd-user-sessions.service      loaded active exited Permit User Sessions
systemd-vconsole-setup.service     loaded active exited Setup Virtual Console

LOAD = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB = The low-level unit activation state, values depend on unit type.

25 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'.

Method 5: How to List all the Service type Unit Files under Systemd in Linux

If you want to list all the Unit Files and its state under Systemd in Linux then you need to use systemctl list-unit-files --type=service command as shown below.

[root@localhost ~]# systemctl list-unit-files --type=service
UNIT FILE                                  STATE
anaconda-direct.service                    static
anaconda-nm-config.service                 static
anaconda-noshell.service                   static
anaconda-pre.service                       static
anaconda-shell@.service                    static
anaconda-sshd.service                      static
anaconda-tmux@.service                     static
anaconda.service                           static
arp-ethers.service                         disabled
auditd.service                             enabled
auth-rpcgss-module.service                 static
autovt@.service                            enabled
blk-availability.service                   disabled
brandbot.service                           static
brltty.service                             disabled
canberra-system-bootup.service             disabled
canberra-system-shutdown-reboot.service    disabled
canberra-system-shutdown.service           disabled
chrony-dnssrv@.service                     static
chrony-wait.service                        disabled
chronyd.service                            enabled
console-getty.service                      disabled
console-shell.service                      disabled
container-getty@.service                   static
cpupower.service                           disabled
crond.service                              enabled
dbus-org.fedoraproject.FirewallD1.service  enabled

Method 6: How to Check the Status of any Specific Running Services in Linux

If you want to check the status of any Specific Running Services in Linux then you need to use below Systemctl command. Here we are checking the status of httpd Service using systemctl status httpd command.

[root@localhost ~]# systemctl status httpd
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
Active: active (running) since Sat 2020-08-29 03:56:30 EDT; 24s ago
Docs: man:httpd(8)
man:apachectl(8)
Main PID: 16205 (httpd)
Status: "Total requests: 0; Current requests/sec: 0; Current traffic: 0 B/sec"
Tasks: 6
CGroup: /system.slice/httpd.service
├─16205 /usr/sbin/httpd -DFOREGROUND
├─16206 /usr/sbin/httpd -DFOREGROUND
├─16207 /usr/sbin/httpd -DFOREGROUND
├─16208 /usr/sbin/httpd -DFOREGROUND
├─16209 /usr/sbin/httpd -DFOREGROUND
└─16210 /usr/sbin/httpd -DFOREGROUND

Aug 29 03:56:30 localhost systemd[1]: Starting The Apache HTTP Server...
Aug 29 03:56:30 localhost httpd[16205]: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using ::1. Set the 'ServerNa...is message
Aug 29 03:56:30 localhost systemd[1]: Started The Apache HTTP Server.
Hint: Some lines were ellipsized, use -l to show in full.

 

 

 

 

 

 

Popular Recommendations:-

Unix/Linux Find Files/Directories owned by a Particular User(5 Useful Examples)

Unix/Linux md5sum Command Examples to Verify Checksum

5 Best Methods to Extract .gz File in Linux using gunzip, gzip and tar tool

12 Popular Unix/Linux uname command examples(How to Get Kernel Version)

How to Transfer Files to AWS EC2 Instance Using WinSCP in 3 Easy Steps

6 Easy Steps to Install Sendmail command in Linux (RHEL/CentOS 7/8)

Easy Steps to Install GCC(C and C++ Compiler) on CentOS 7

How to Transfer Files to an AWS EC2 Instance Using WinSCP in 3 Easy Steps

Leave a Comment