How do you kill a PID process in Linux?

I always use killall -9 process command to kill process in Linux. Is it possible to kill a PID process in Linux? I try as follows

pidof nginx

Now I try to kill nginx by a PID 29782

killall -9 29782

It spit out error :face_with_raised_eyebrow:

29782: no process found

I mean how do I do it with a PID?

1 Like

You need to use the kill command for that purpose:

kill -15 29782
kill -9 29782

Use the pgrep or ps to find a PID of process in Linux:

pgrep mysqld
ps aux | grep mysql
pidof mysql

Now kill it with kill command:

kill -15 PID

See the following for more info