How to find process name?
Andrew Henderson
Does every service that is active running have a process that can be seen by ps command on linux?
If yes, how can I find the related process name?
For example if ntp is running, should I see it by the name ntp in ps -aux | grep ntp?
1 Answer
does every service that is active running have a process that can be seen by ps command on linux
Yes.
for example if ntp is running, should I see it by the name ntp in ps -aux | grep ntp? thanks
Yes.
$ ps -aux | grep ntp
ntp 1142 0.0 0.0 40264 1456 ? Ss Feb25 5:07
/usr/sbin/ntpd -p /var/run/ntpd.pid -g -c /var/lib/ntp/ntp.conf.dhcp -u 105:112It will, at least, show the name of the daemon and the user. In the case of "ntp" that would be "ntpd" and "ntp". There are services that (by default) use another user name than the name of the process though: apache user "www-data" as a username and "apache2" is the process.
From comments:
How can I find the exact process name of a service then?
I tend to know the names of all the processes running on my system. Apache does not work when searching through systemd:
$ ps -ef | grep apache
www-data 9799 1638 0 11:21 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 12293 1638 0 12:00 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 12727 1638 0 12:02 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 13122 1638 0 12:08 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 13711 1638 0 12:18 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 14004 1638 0 12:20 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 14013 1638 0 12:20 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 14120 1638 0 12:22 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 15079 1638 0 12:41 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 15557 1638 0 12:51 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 15783 1638 0 12:57 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 15786 1638 0 12:57 ? 00:00:00 /usr/sbin/apache2 -k start
$ sudo systemctl list-unit-files | grep apache
$ sudo systemctl list-unit-files | grep https
$ sudo systemctl list-unit-files | grep httpNo everything is a systemd service ;)
8