Centos – the recommended way of checking running services

centosdebianservicessles

I'm often exposed to various GNU/Linux systems including CentOS, SLES and Debian.

I want to know: what is the recommended method of checking all running services across these systems?

I am aware of service --status-all and chkconfig but they are not always available.

Please advise.

Best Answer

I want to know: what is the recommended method of checking all running services across these systems?

Since you are aware of chkconfig,service, and may be ntsysv,rcconf,

but you can check using below command which almost work in all flavor

ls -1 /etc/rc$(runlevel| cut -d" " -f2).d/S*

What is S* ?

the traditional init style makes symlinks that start with S, or K. those with S means "start", and they are run with the "start" parameter when that runlevel is entered. Those with K means "kill", those services are run with the "stop" parameter when that runlevel is entered

Full details:

ls -1 /etc/rc$(runlevel| cut -d" " -f2).d/S* | \
awk -F'[0-9][0-9]' '{print "Startup :-> " $2}'

Output:

Startup :-> bind9
Startup :-> apt-cacher-ng
Startup :-> slapd
Startup :-> cron
Startup :-> dmesg
Startup :-> inetutils-inetd
Startup :-> ssh
Startup :-> dns-clean
Startup :-> sudo
Startup :-> apache2
Startup :-> grub-common
Startup :-> ondemand
Startup :-> rc.local
Related Question