2 Methods to Check if Linux System uses systemd

2 Methods to Check if Linux System uses systemd

Most Linux distributions - including Ubuntu, Fedora, openSUSE, and Arch - use systemd as their default init system. However, there are several notable non-systemd distributions as well. This difference can become a problem when you're following a tutorial or guide that assumes you're using systemd. Commands and services may behave differently - or not exist at all - if your system uses an alternative init system. This tutorial provides 2 methods how to check if Linux system uses systemd.

Method 1 - readlink command

To find out whether the system is using systemd, simply run the following command:

readlink /sbin/init

The readlink command directly shows where /sbin/init points. If you see systemd in the path, then the system uses it.

Output example:

/lib/systemd/systemd

Method 2 - ls command

You can also extract the symlink target using ls -l combined with awk to print the destination:

ls -l /sbin/init | awk '{print $NF}'

Again, the presence of systemd in the output confirms it's in use.

Leave a Comment

Cancel reply

Your email address will not be published.