ps aux | grep <search-term>
shows processes matching search-term
Example:
root@server7:~# ps aux | grep nginx
root 315 0.0 0.3 144392 1020 ? Ss May28 0:00 nginx: master process /usr/sbin/nginx
www-data 5647 0.0 1.1 145124 3048 ? S Jul18 2:53 nginx: worker process
www-data 5648 0.0 0.1 144392 376 ? S Jul18 0:00 nginx: cache manager process
root 13134 0.0 0.3 4960 920 pts/0 S+ 14:33 0:00 grep --color=auto nginx
root@server7:~#
Here, second column is the process id. For example, if you want to kill the nginx process, you can use the command kill 5647
. It is always adviced to use the kill
command with SIGTERM
rather than SIGKILL
.