What is the recommended way of checking running services?
Solution 1
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
Solution 2
A little less elegant but you can always compare what is running ps aux
against what is listed in /etc/init.d/
or /etc/rc.d/
Related videos on Youtube
synack
Current interests [July 2013] : Computer networks, Network/webapp security, Virtualization, c/c++ and C# programming (beginner stages.)
Updated on September 18, 2022Comments
-
synack over 1 year
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
andchkconfig
but they are not always available.Please advise.
-
synack almost 11 yearsAny Debian-like equivalent to this?
-
synack almost 11 yearsNice answer, although you might want to correct your spelling of chkconfig for future readers.
-
Rahul Patil almost 11 years@synack Thanks.. I have corrected that.. if this answer satisfy you, So can you mark it as correct.
-
Pablo A over 6 yearsIn my case (Ubuntu 16.04) your command list -> 41,
rcconf --list | grep " on$" | wc -l
-> 56,service --status-all | grep -F "[ + ]" | wc -l
-> 47,systemctl list-unit-files --state=enabled
-> 73. Why this might be? Just enabled vs running?