When you start a Linux system, it starts with only one process, a program called init.
Since the launch of UNIX version five (System V), the SysV init system has been the most popular and it made to the Linux systems in 1991.
It remained the most popular init system for years but gradually, many Linux distributions started using OpenRC, Runit, UpStart etc.
At present, systemd is widely used and thus you are likely to be using systemd on your system.
But how do you confirm it? You run this command:
ps -p 1 -o comm=
If you get systemd in the output, you are using systemd.
That works for Linux distributions using systemd but what if you are using some other init system? Let's discuss that part as well
Checking the init system in Linux
Remember that the init is the first process to start in your Linux system.
This means that the detail lies in the process with PID 1. Check the process 1 then:
But unfortunately, that's not enough because the the process if often showed as /sbin/init and that doesn't give accurate information.
[email protected]:~$ ps 1 PID TTY STAT TIME COMMAND 1 ? Ss 0:01 /sbin/init splash
The /sbin/init is a symbolic link to the actual init process. You can follow the symbolic link and see real process.
I am using the stat command and you can see that /sbin/init is linked to /lib/systemd/systemd in Ubuntu.
[email protected]:~$ stat /sbin/init File: /sbin/init -> /lib/systemd/systemd Size: 20 Blocks: 0 IO Block: 4096 symbolic link Device: 10306h/66310d Inode: 30675721 Links: 1 Access: (0777/lrwxrwxrwx) Uid: ( 0/ root) Gid: ( 0/ root) Access: 2022-09-21 09:17:59.616364311 +0530 Modify: 2022-06-27 23:58:46.000000000 +0530 Change: 2022-07-12 18:24:23.667196373 +0530 Birth: 2022-07-12 18:24:23.667196373 +0530
This is an indication that systemd is in use.
Take another example. I am using Alpine Linux version 3.16. Here's the init information.
localhost:~# stat /sbin/init File: '/sbin/init' -> '/bin/busybox' Size: 12 Blocks: 0 IO Block: 4096 symbolic link Device: 800h/2048d Inode: 169 Links: 1 Access: (0777/lrwxrwxrwx) Uid: ( 0/ root) Gid: ( 0/ root) Access: 2022-09-22 04:53:46.677137693 +0000 Modify: 2022-07-21 04:10:19.149395174 +0000 Change: 2022-07-21 04:10:19.149395174 +0000
As you can see, Alpine Linux is using the lightweight BusyBox init system.
You may also use the
pstree command but that may not work in every other distribution to identify the init system.
For Ubuntu, it clearly indicates if the Linux distro is using systemd.
As you can see, it might not be straightforward but it's not that complicated as well to know whether your Linux system is using systemd or not.