systemd services Status

Example of systemctl status

I’ve just learned by accident that it’s possible to run systemctl status without specifying a name of systemd service – this way you get the listing and status of all the services available in a neat tree structure.

SystemD services

As you may remember, startup services are no longer managed by /etc/init.d scripts in Linux. Instead systemd services are created – this is handy for both managing services and confirming their status (journalctl is great for showing latest status messages like error log).

Show systemd Services Status with systemctl

Run without any parameters, systemctl status command will show you a tree structure like this:

greys@sd-147674:~$ systemctl status
 ● sd-147674
     State: running
      Jobs: 0 queued
    Failed: 0 units
     Since: Sat 2019-11-23 08:45:20 CET; 1 months 20 days ago
    CGroup: /
            ├─user.slice
            │ └─user-1000.slice
            │   ├─user@1000.service
            │   │ └─init.scope
            │   │   ├─19250 /lib/systemd/systemd --user
            │   │   └─19251 (sd-pam)
            │   └─session-1309.scope
            │     ├─19247 sshd: greys [priv]
            │     ├─19264 sshd: greys@pts/0
            │     ├─19265 -bash
            │     ├─19278 systemctl status
            │     └─19279 pager
            ├─init.scope
            │ └─1 /sbin/init
            └─system.slice
              ├─systemd-udevd.service
              │ └─361 /lib/systemd/systemd-udevd
              ├─cron.service
              │ └─541 /usr/sbin/cron -f
              ├─bind9.service
              │ └─587 /usr/sbin/named -u bind
              ├─systemd-journald.service
              │ └─345 /lib/systemd/systemd-journald
              ├─mdmonitor.service
              │ └─484 /sbin/mdadm --monitor --scan
              ├─ssh.service
              │ └─599 /usr/sbin/sshd -D
              ├─openntpd.service
              │ ├─634 /usr/sbin/ntpd -f /etc/openntpd/ntpd.conf
              │ ├─635 ntpd: ntp engine
              │ └─637 ntpd: dns engine
              ├─rsyslog.service
              │ └─542 /usr/sbin/rsyslogd -n -iNONE
...

In this output, you can see systemd service names like cron.server or ssh.service and then under them is the process name and numerical process ID that indicate the how each service is provided.

INTERESTING: Note how openNTPd.service is provided by 3 separate processes: ntpd and two other ntpd processes (NTP engine and DNS engine).

See Also