LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   What is the more easier way to check the pid and kill the pid (https://www.linuxquestions.org/questions/linux-general-1/what-is-the-more-easier-way-to-check-the-pid-and-kill-the-pid-667780/)

cmx08 09-05-2008 10:38 AM

What is the more easier way to check the pid and kill the pid
 
What is the more easier way to check the pid and kill the pid? I use the ps ux command to list all the pid but the list is too long already and I use the kill pid to kill the process but it is not successful. So I need to use the kill -9 pid to kill the process. What is -9 mean?

Thx.

David the H. 09-05-2008 10:48 AM

'ps ux | grep programname' will filter the list for only what you want to find.

-9 is basically the "force termination" signal, the one that bypasses all efforts to safely shut down the process. You should only use it when nothing else works.

Have a look at the killall and pkill commands, both of which can kill processes by name. They can be a bit dangerous though if you have multiple processes with the same name.

Read these manpages for more:

man kill
man pkill
man killall
man 7 signal

Edit: this page has a simple rundown on Unix signals:
http://everything2.com/e2node/unix%2520signals

cmx08 09-08-2008 06:41 AM

Thx a lot for your help.

bathory 09-08-2008 07:17 AM

You can also use pidof that gives you the pid of programname:
Code:

kill -9 `pidof programname`
Regards

rob.rice 09-09-2008 10:46 PM

the easy way
"killall program-name"

dv502 09-09-2008 10:57 PM

A variation of above

pkill <signal> <application or daemon>


All times are GMT -5. The time now is 04:35 AM.