How could I know if my linux starts with
systemd or whatever package?
Check what process is running as PID 1. You can do this by running
ps aux | less and scrolling to the top. If you have some systemd thing running as PID 1, you have systemd running.
systemctl to list running systemd units.
You might also want to check what /sbin/init is;
file /sbin/init will tell you if it's a real executable or if it's a symbolic link to some other package's executable. On a systemd box, for example:
root@boxy / # file /sbin/init /sbin/init: symbolic link to ../lib/systemd/systemd
For more information, check this out: https://en.wikipedia.org/wiki/Linux_startup_process
EDIT: As noted by deltab's comment, rather than using
ps aux | less,
ps 1 is a better way to do this. Thanks for clearing that up!
EDIT2: Another way of seeing exactly what you have on your system is typing
man init and seeing which program's man page you end up on.
I know this is an old question, but since I was just asking myself the same question - here are my 2ct.
Best solution I came up with
ps --no-headers -o comm 1
This returns either
init and appears reliable across Linux distributions and releases.
file /sbin/init would work, with help of pattern matching. Output of
ps 1 does not appear helpful since on some Linux distributions it will print 'init' (the symlink) despite systemd being used.
$ ps 1 PID TTY STAT TIME COMMAND 1 ? Ss 0:02 /sbin/init $ file /sbin/init /sbin/init: symbolic link to /lib/systemd/systemd
$ ps 1 PID TTY STAT TIME COMMAND 1 ? Ss 7:46 /usr/lib/systemd/systemd --switched-root --system --deserialize 21 $ file /sbin/init /sbin/init: symbolic link to `../lib/systemd/systemd'
$ ps 1 PID TTY STAT TIME COMMAND 1 ? Ss 0:24 /usr/lib/systemd/systemd --switched-root --system --deserialize 21 $ file /sbin/init /sbin/init: symbolic link to `../usr/lib/systemd/systemd'
$ ps 1 PID TTY STAT TIME COMMAND 1 ? Ss 0:33 /sbin/init showopts $ /sbin/init: symbolic link to `../usr/lib/systemd/systemd'