LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 09-05-2008, 10:38 AM   #1
cmx08
Member
 
Registered: Aug 2008
Location: Malaysia
Distribution: Fedora Core
Posts: 35

Rep: Reputation: 15
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.
 
Old 09-05-2008, 10:48 AM   #2
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,823

Rep: Reputation: 1948Reputation: 1948Reputation: 1948Reputation: 1948Reputation: 1948Reputation: 1948Reputation: 1948Reputation: 1948Reputation: 1948Reputation: 1948Reputation: 1948
'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

Last edited by David the H.; 09-05-2008 at 11:04 AM.
 
Old 09-08-2008, 06:41 AM   #3
cmx08
Member
 
Registered: Aug 2008
Location: Malaysia
Distribution: Fedora Core
Posts: 35

Original Poster
Rep: Reputation: 15
Thx a lot for your help.
 
Old 09-08-2008, 07:17 AM   #4
bathory
Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 10,937

Rep: Reputation: 1330Reputation: 1330Reputation: 1330Reputation: 1330Reputation: 1330Reputation: 1330Reputation: 1330Reputation: 1330Reputation: 1330Reputation: 1330
You can also use pidof that gives you the pid of programname:
Code:
kill -9 `pidof programname`
Regards
 
Old 09-09-2008, 10:46 PM   #5
rob.rice
Member
 
Registered: Apr 2004
Distribution: slack what ever
Posts: 791

Rep: Reputation: 112Reputation: 112
the easy way
"killall program-name"
 
Old 09-09-2008, 10:57 PM   #6
dv502
Member
 
Registered: Sep 2006
Location: USA - NYC
Distribution: Whatever icon you see!
Posts: 642

Rep: Reputation: 57
A variation of above

pkill <signal> <application or daemon>
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
What does kill -0 PID do? asihsh.nakul Linux - Newbie 16 11-14-2012 05:18 PM
kill <pid> does not do anything moskito01 Linux - General 9 08-25-2009 12:20 PM
kill pid ekdya Debian 3 04-18-2006 05:04 PM
kill pid.... won't work with 'pid' variable given.. sachitha Programming 6 03-06-2006 07:48 PM
/var/run/[XXX].pid - Tcl pid code liguorir Linux - Software 1 05-20-2004 10:32 PM


All times are GMT -5. The time now is 05:11 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration