Linux bash pidof command wont work

Lucas Ou-Yang picture Lucas Ou-Yang · Sep 26, 2012 · Viewed 10.9k times · Source

This is a minor error that I can't figure out. When I enter the pidof command to shut down a process, the command line just executes pidof and goes to the next line and nothing happens. No error message no nothing.

Example:

pidof supervisord

Answer

PherricOxide picture PherricOxide · Sep 26, 2012

That's the expected behavior of pidof when it doesn't find any processes by that name.

Also, it doesn't kill the process, just returns the process ID of it. You want to use "killall" to actually kill a process, or a combination of "pidof" to get the PID and "kill" to kill that PID.

killall supervisord

Or

kill $(pidof supervisord)