How to find the PID of nginx process

ps

I am trying to fix a problem with nginx and think that there is an nginx process running on my machine. When I run this command I get this output.

$ ps aux -P | grep nginx
1000      3947  0.0  0.0  13596   932 pts/0    S+   14:05   0:00 grep --color=auto nginx

But if I try to kill processes 1000, 3947, 13596 or 932 I get errors like:

bash: kill: (1000) - No such process

What's going on? How do I find and kill the nginx process?

Best Answer

I usually find pgrep more convenient than ps | grep. You might also want to look at killall if the end goal is blasting a bunch of processes by name.

Related Question