Sunday, September 10, 2023

Determine if your system is using systemd

Systemd is a suite of basic building blocks for a Linux system that provides a system and service manager that runs as PID 1 and starts the rest of the system. It works as a replacement for sysvinit.
Almost all popular distros are using systemd, but if you need to use old version of the popular distros, or simply some non popular distros, here is how you can determine whether the linux your are having is using systemd, or not.

First, check which process is running PID 1.
$ ps 1

The output, most of the time will be /sbin/init. 






Now we need to determine if /sbin/init is a symlink to something else. There are 2 commands we can use to achieve that:
1. use stat
$ stat /sbin/init
2. use readlink
$ readlink /sbin/init

In a systemd based system, you will be getting output showing that /sbin/init is actually a symlink to /lib/systemd/systemd, where as in other system, you will not get that output.




No comments:

Post a Comment