How do I know if Ubuntu Linux is using systemd or init?

How can I confirm and find out if my Ubuntu Linux boots with systemd or init or something else? Is there anyway to find out this information?

A process identification number (PID) is automatically assigned to each process when it is created on a Linux. For example, the systemd or init will always have PID # 1 because that is the first process on Linux. Hence, finding a program associated with PID # 1 will tell you if you are using systemd or init or anything else, not just on Ubuntu but all other Linux distros.

How to know if I am using systemd on Linux

Run

ps --pid 1
sudo ps --pid 1
# if ps is not supporting --pid 1 option, then run
ps aux | grep init
ps aux | grep '/sbin/init'

The output indicate that I am using systemd

    PID TTY          TIME CMD
      1 ?        00:02:13 systemd

Another trick is:

file /sbin/init 

And here is what I see:

/sbin/init: symbolic link to /lib/systemd/systemd

Then you can also use:

ls -l /sbin/init
lrwxrwxrwx 1 root root 20 Jul 22 00:30 /sbin/init -> /lib/systemd/systemd

An example of busybox as init used by Alpine Linux

ls -l /sbin/init
ps aux | grep init
ls -l /sbin/init

2 Likes

OpenSUSE Linux

ps --pid 1
ps 1

openSUSE Leap 15.2

  PID TTY      STAT   TIME COMMAND
    1 ?        Ss    37:20 /usr/lib/systemd/systemd --system --deserialize 18

CentOS and RHEL 8

ps --pid 1

CentOS 8.4:

    PID TTY          TIME CMD
      1 ?        00:00:00 systemd

Debian Linux

ps --pid 1

Debian Linux 10.10

    PID TTY          TIME CMD
      1 ?        00:00:00 systemd

Arch Linux

$ ps --pid 1
# output from arch linux vm
    PID TTY          TIME CMD
      1 ?        00:00:00 systemd
1 Like

Linux sysadmin blog - Linux/Unix Howtos and Tutorials - Linux bash shell scripting wiki