Kill Process in Linux or Terminate a Process in UNIX / Linux Systems

by on August 1, 2006 · 90 comments· LAST UPDATED May 30, 2013

in , ,

I am a new Linux system user. How do I kill process on Linux based server using command line options? How can I kill running process on Unix?

Linux and Unix-like operating system come with the kill command to terminates stalled or unwanted processes without having to log out or restart the server.

The kill command sends the specified signal such as kill process to the specified process or process groups. If no signal is specified, the TERM signal is sent. Please note that kill command can be internal as part of modern shells built-in function or external located at /bin/kill. Usage and syntax remain similar regardless internal or external kill command.

Tutorial details
DifficultyEasy (rss)
Root privilegesYes
Requirementskill
Estimated completion time10 minutes

A list of common Term singles

Linux and Unix-like operating system supports the standard terminate signals listed below:

  1. SIGHUP (1) - Hangup detected on controlling terminal or death of controlling process. Use SIGHUP to reload configuration files and open/close log files.
  2. SIGKILL (9) - Kill signal. Use SIGKILL as a last resort to kill process. This will not save data or cleaning kill the process.
  3. SIGTERM (15) - Termination signal. This is the default and safest way to kill process.

What is a PID?

A Linux or Unix process is running instance of a program. For example, Firefox is a running process if you are browsing the Internet. Each time you start Firefox browser, the system is automatically assigned a unique process identification number (PID). A PID is automatically assigned to each process when it is created on the system. To find out PID of firefox or httpd process use the following command:

 
pidof httpd
pidof apache2
pidof firefox
 

OR use the combination of ps command and grep command:

 
ps aux | grep httpd
ps aux | grep apache2
ps aux | grep  firefox
 

Sample outputs:

Fig.01: Find the process ID (PID) of a running firefox program and apache2 server.

Fig.01: Find the process ID (PID) of a running firefox program and apache2 server.

kill command syntax

The syntax is:

 
kill [signal] PID
kill -15 PID
kill -9 PID
kill -SIGTERM PID
kill [options] -SIGTERM PID
 

What Linux or Unix permissions do I need to kill a process?

Rules are simple:

  1. You can kill all your own process.
  2. Only root user can kill system level process.
  3. Only root user can kill process started by other users.

kill command examples

In this example, I am going to kill lighttpd server.

Step #1: Find out the PID (process id)

Use the ps or pidof command to find out PID for any program. For example, if process name is lighttpd, you can use any one of the following command to obtain process ID:

 
pidof lighttpd
 

Sample outputs:

3486

OR

 
ps aux | grep lighttpd
 

Sample outputs:

lighttpd  3486  0.0  0.1   4248  1432 ?        S    Jul31   0:00 /usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf
lighttpd  3492  0.0  0.5  13752  3936 ?        Ss   Jul31   0:00 /usr/bin/php5-cg

Step #2: kill the process using a PID

The PID # 3486 is assigned to the lighttpd process. To kill the lighttpd server, you need to pass a PID as follows:
# kill 3486
OR
$ sudo kill 3486
This will terminate a process with a PID of 3486.

How do I verify that the process is gone / killed?

Use the ps or pidof command:
$ ps aux | grep lighttpd
$ pidof lighttpd

A note about sending stronger signal # 9 (SIGKILL)

If no signal specified in the kill command, signal # 15 (SIGTERM), is sent by default. So the kill 3486 command is same as the following command:
# kill -15 3486
# kill -SIGTERM 3486

OR
$ sudo kill -15 3486
$ sudo kill -SIGTERM 3486

Sometime signal # 15 is not sufficient. For example, lighttpd may not be killed by signal #15 due to open sockets. In that case process (PID) # 3486 would be killed with the powerful signal # 9:
# kill -9 3486
# kill -SIGKILL 3486

OR
$ sudo kill -9 3486
$ sudo kill -SIGKILL 3486

Where,

  • -9 or -SIGKILL - A special kill signal that nearly guarantee to kill the process with the iron fist.

How can I kill two or more PIDs?

The syntax is as follows to kill two or more PIDs as required can be used in a single command:

 
kill  pid1 pid2 pid3
kill -15  pid1 pid2 pid3
kill -9  pid1 pid2 pid3
kill  -9 3546 5557 4242
 

Say hello to killall command

This is a Linux only command. to kill processes by name. So no need to find the PIDs using the 'pidof process' or 'ps aux | grep process' command. Do not use killall command on Unix operating systems. This is a Linux specific command.

The syntax is

 
killall Process-Name-Here
 

To kill the lighttpd server, enter:
# killall -15 lighttpd
OR
# killall -9 lighttpd
To kill the Firefox web-browser process, enter:
# killall -9 firefox-bin

As I said earlier, the killall command on UNIX-like system does something else. It kills all process and not just specific process. Do not use killall on UNIX system.

TwitterFacebookGoogle+PDF versionFound an error/typo on this page? Help us!

{ 90 comments… read them below or add one }

1 kavita December 19, 2006 at 8:34 am

how to kill a process using system call?

Reply

2 ganesh October 24, 2007 at 9:00 am

Kill are of two types:

1.Graceful Kill
kill -15 pid
2.Forcible Kill

Kill -9 pid.

Kill pid. This format wont work.. Just check it..

These kill differs in releasing resources forcibly or gracefully……….

Reply

3 Josir November 27, 2007 at 12:56 pm

I login as root, kill -9 a process but it refuses to stop. Is there a more powerful command?

Reply

4 kavya October 11, 2010 at 3:35 am

use top command it will list the running processes dynamically then press “K” it will ask for process ID(PID) so enter the PID of the process you want to kill.

Reply

5 Shehab February 26, 2008 at 2:07 pm

Ganesh
the kill pid works fine if u’re logged in as the root.

Reply

6 Manojg June 6, 2008 at 1:47 pm

I tried to kill a process by kill -9 PID in user as well root mode. But it could not kill the process. What is another way to force kill?

Reply

7 mircea June 26, 2008 at 6:00 pm

Is the process changing PID after your kill -9 command? Because if it does it means it is a new process. This usually happens with apps that are beeing watched by some other process that will respawn the dead process.
To kill such a process you first need to find out what are the means used to respawn it and act accordingly. A “ps axf” will show you the relationship between processes. If the preocess you try to kill is a child of other process then it is most likely that the parent is respawning the child. So you will need to kill that process first. Otherwise, kill -9 used as root is “invincible” :)

Reply

8 Shivin Vijai December 3, 2008 at 9:07 am

Hi,

One small doubt .

I know parent of all process is init and its PID is zero. Can i kill pid zero? What happend to the system if i kill pid zero?

Regards
Shivin

Reply

9 Ethan "eekee" Grammatikidis January 23, 2009 at 1:02 am

I have a process that will not respond to any kill signal, nor can bash suspend it, nor did it react on removal of the USB device it was trying to access. I’m told it could be a buggy driver holding a global semaphore or “oopsed”, whatever that is. I guess there are some things that only a reboot will fix. :)

Reply

10 Jeff February 5, 2009 at 7:12 pm

If it is respawning based on an entry in your inittab then you can modify the inittab (eg. remark the entry out) then issue :

/sbin/telinit q

telinit is linked to init and the q flag tells init to re-examine the inittab file.

Reply

11 karthickelc February 19, 2009 at 12:09 pm

i have inserted a pendrive in suse linux sp10. when i try to remove the pen drive the dialog displays device busy and shows its process id. every time i use the command kill -9 pid .
how can i avoid this?

Reply

12 Ankit Anant August 30, 2010 at 11:18 am

When ever you insert you pen-drive to your system, it gets mounted in a particular directory, by default it mounts in /media in most OS. It is quite possible that you have not unmounted that pen-drive from that directory to which it has mounted.

Reply

13 Klimentine April 26, 2009 at 12:33 pm

Thanks for this tuto, is simple and easy to use

Reply

14 maibangcomputer May 6, 2009 at 5:34 am

thank you, it works…

Reply

15 Sanjay May 15, 2009 at 2:25 pm

Thanks a lot dude!!!

Reply

16 Shinnosuke June 26, 2009 at 10:56 pm

I got a window I cannot close, it is on top and I cannot access to the menus. I cannot move it either, the cursor cannot be moved outseide that window. So the only way to close the application should be a key combination, isn’t it? But which? (BTW, I’m a complete newbie, trying Ubuntu for the first time)

Reply

17 sshah July 7, 2009 at 8:00 am

Anybody can guide me how can I kill time based processes? for example I want to kill processes that are 1 day old.

Reply

18 Russel May 17, 2011 at 7:08 am

I was having this same problem. I know you must have use the man and got frustrated after “killall -o 1d” didn’t work. It turns out that the important thing that we missed was that TIME must be a string. In other words …. “killall -o 1.0d”
That works .

Reply

19 zaheer arif August 4, 2009 at 11:49 am

Dear I have a question.
Suppose i have a function that does some calculations.Well what i want to do,I want to stop the calculations in that function after some time (suppose 5 seconds).I really appreciate if anybody guides me in this regard.

thanks in Advance

Reply

20 vishnu August 7, 2009 at 3:57 pm

Very very nice

Reply

21 zaheer arif August 12, 2009 at 1:36 pm

What is nice ?

Reply

22 Natirips August 20, 2009 at 5:42 pm

“nice” is how nice a process is. The higher the number, it will tend to let other processes use CPU more. If negative, it has higher priority that other processes. Zero (0) is normal. See “man renice” to see how to change the “nice” value.

Reply

23 linuxnaveen August 26, 2009 at 10:10 am

Dear Shivin,
The Init is the parent of all the process.The PID no is always One (1).
It’s an Parent of all the process so we called PPID.
All the runlevels are run under init.So it’s look like parent of all the runlevels.
If you kill the init ,then how it works…?

Thanks & Regards,
EverFriendly Naveen

Reply

24 Ankit Anant August 30, 2010 at 11:24 am

If someone kill the init process, will the run labels work? Will the other processes not effected ??
Is there any other method?

Reply

25 linuxnaveen August 26, 2009 at 10:33 am

Dear Shivin,
The root PID is zero (0)

Run this command it will show
pidof root
pidof init

The root is an User.The User informtions are stored in /etc/passwd file
in this file show
username,password,userid,groupid,gecos field,home directory,shelltype

The third field denotes the UID of the User.

Thanks & Regards,
Ever Friendly Naveen

Reply

26 Ankur Sinha September 1, 2009 at 7:28 am

Nice Article!!!!
Thanks!!!

Reply

27 kunal September 10, 2009 at 9:31 am

how kill command proceed???

Reply

28 Raghavi October 22, 2009 at 12:37 pm

iam getting this errror plz…. help me

[xsxsx@ip-111-111-11-111 javautils]$ kill 20073
-bash: kill: (20073) – No such process

Reply

29 Ankit Anant August 30, 2010 at 11:27 am

Please try to kill forcefully as:
$kill -9 20073

Reply

30 Mircea October 22, 2009 at 1:09 pm

This usually means exactly what the message says: there is no process with that id running. This may be due to short lived processes or simply a typo in the command line

Reply

31 Natirips October 22, 2009 at 1:37 pm

If you’re shore that you’ve seen a process with that PID, it may have died/ended on it’s own before you could type the command. You can check if a process is alive with “ps -e” (without the quotes) and looking at the list, or just “ps -e|grep 12345″ to see if a process with PID 12345 exists or not. Note that every time you start an application, it will get a different PID. So if you killed a broken MPlayer or VLC (for example), when you start it again it will have another PID. If you start two instances of it, each will have it’s own PID. Also, the same PID my accidentally later be given to a completely different application. So never remember PID of given process by long term means.

Reply

32 jw tech November 9, 2009 at 7:55 pm

I am using the
sudo killall -u root
as root but once all the machines have been killed the command will not end/terminate I have to go in and click the stop button.

Reply

33 SonhadorPR November 24, 2009 at 4:33 am

Following a few of the commands, the kill -9 or kill -15 PID did not work for me, because it kept changing, like mircea had mentioned, it apparently was attached to another process. However, nobody told me how to find the other process…so I used the sudo killall -u root, mentioned by jw tech, and all it did was log me out of my session, however, for some reason it also killed the USB, because the mouse and keyboard did not respond.
Had to manually turn machine off…waste of time, I could have turned off machine from beginning!
Any other step-by-step commands for newbies like me?
Let meknow: sonhadorpr_at_gmail_dot_com

Reply

34 Natirips November 24, 2009 at 5:31 pm

killall -u root is only usefull if you’re trying to shutdown the machine “gently” as it kills everything it can.

Use “$ ps -ejH” to display all processes in a tree. You might want to also “$ ps -ejH>tempprocesseslist;gedit tempprocesseslist;rm tempprocesseslist” to view the files nicely. Use ‘kate’, ‘mousepad’, ‘vi’, ‘nano’ or whatever instead of ‘gedit’ if you like/need.

Btw, don’t type/copy-paste the quotes and the $ sign ^^.

Now if you’re killing a process but it jumps back, maybe try killing/debugging it’s parent instead. Parent processes are those to the left (with less spacing at the left side) in the “tree”.

Explanation:
‘$ ps -ejH’
Displays all processes in a tree. This part is almost absolutely harmless (it takes up a lot of screen space). Use shift+pageUp/pageDown to scroll through the list if you’re stuck in CTRL+ALF+F1-6.

‘$ ps -ejH>tempprocesseslist’
Outputs to a file named ‘tempprocesseslist’ instead of screen. You can use any other filename istead of ‘tempprocesseslist’, but than you must use the same one in all three commands.

‘$ ps -ejH>tempprocesseslist;gedit tempprocesseslist’

Also open the file in text editor.
‘$ ps -ejH>tempprocesseslist;gedit tempprocesseslist;rm tempprocesseslist’
Also remove the file after it is no longer needed.

Reply

35 Mackie Mathew December 9, 2009 at 4:40 am

I like to get a tree view before killing off a process. Graphics make me happy :) and also useful when the process table is a bit too complex to grasp.

If I want to kill firefox (No offence mozilla ;), this is what I use:

pstree -p | grep fire*

this displays:
|-firefox(28060)-+-{firefox}(28070)
| |-{firefox}(28071)
| |-{firefox}(28072)

Then I would kill it using:
kill -9 28060

Reply

36 Christer Jonassen January 1, 2010 at 6:02 pm

Exactly what I needed to kill a troublesome process on my old Clark Connect box!
Thanks!

Reply

37 Busandi Lal January 25, 2010 at 7:10 am

Hey, you can also use grep command for killing the processes and ls is best known utility for this.

Reply

38 Natirips January 25, 2010 at 12:31 pm

“grep” doesn’t kill a process, it is only used to filter output of other commands such as “ps” or “pstree”, at least in this context.

“ls” has practically absolutely nothing to do with killing a process. It is used to list segments (usually files) in a directory.

Reply

39 Michael January 28, 2010 at 2:06 pm

What Suse Linux permissions do I need to kill a process?

Reply

40 Natirips January 28, 2010 at 3:26 pm

I’m not 100% sure as I’m not a Suse user, but this should do if you don’t have permissions to kill it:

$ su
Password:
# ps -e|grep part-of-process-name
# kill -9 PID
# exit
$ echo continue with what you were doing

Where PID is process ID (that number). You can use ‘pstree’ instead of ‘ps -e|grep blah’ if you want.

Reply

41 kay March 2, 2010 at 11:11 am

how can i kill safari?

Reply

42 Natirips March 2, 2010 at 1:11 pm

OK. Here’s step-by-step how to kill anything.

Open a terminal (Konsole, Terminal, xterm, gnome-terminal, or press CTRL+ALT+F1*). Don’t type in the $ and # signs. Those indicate the beginning of a line which you have to type. *You can use any key from F1 to F6 here. Press CTRL+ALT+F7 to go back to the GUI.

Type:
$ ps -e
If you don’t see the whole list, you can scroll up and down with SHIFT+PAGE_UP and SHIFT+PAGE_DOWN.

Find the process’ number and type:
$ kill 12345
Where 12345 is the number of your process.

If it didn’t die, type:
$ kill -9 12345
Where 12345 is the process’ number.

If it still didn’t die, type:
$ su
# kill -9 12345
# exit
You can also use:
$ sudo su
instead of “$ su” if you don’t know/have the root password but you happen to be a sudo-er.

If it still didn’t die, type:
$ pstree
Now find process’ parent process (the one to the left of it), and repeat everything for the parent process.

Warning: don’t try killing “gdm”, “kdm”, “xdm” or “init” unless you really know what you’re doing.

You can also use:
$ pkill fullprocessname
instead of
$ kill processnumber
You can usually see the full process’ name in the “pstree” and “ps -e”, next to it’s number.

If you want to kill all instances of something, type:
$ killall fullprocessname

Full process name may be different from the program’s name, for example firefox’s full process name may be “firefox-bin” instead of just “firefox”.

Both pkill and killall can use -9 parameter as well. This parameter tells it to kill forcefully (and not gently). For example:
$ pkill -9 firefox-bin
$ killall -9 npviewer.bin

Reply

43 kay March 2, 2010 at 2:40 pm

many thanks
do you know how can i remove an application using unix command?

Reply

44 kashyap May 24, 2011 at 5:31 am

use rpm -e

Reply

45 rajeev March 29, 2010 at 11:10 am

What is the method used for killing init process using kill command?
During shutdown of the system, the init process is killed by the kernel , I want to know is their any method to kill it using kill command so that i can shutdown my computer on killing the init process.

please do reply?

Reply

46 Natirips March 29, 2010 at 6:23 pm

You may be looking for this: http://en.wikipedia.org/wiki/Magic_SysRq_key

So alt+sysrq+o shuts down the system.

Otherwise init always has PID 1, so “sudo kill -9 1″ or “sudo pkill -9 init” or “sudo killall -9 init” will kill init abruptly. Use -15 instead of -9 or omitt it completely to do it more “gently”, although kill init itself isn’t very gentle method >_<.

Reply

47 Anonymous April 2, 2010 at 12:10 pm

what is force killing of process?how can it be done?

Reply

48 unfa April 4, 2010 at 10:04 pm

Thanks a lot! That is what I’ve been looking for half a year since started playing Nexuiz – it tends to block Gnome sometimes when i try to shut it down, killall didn’t help, now -9 parameter did the job. Before I got here, I had to restart X server using Ctrl+Alt+BckSpc and I was unable to save mo work in other programs. Now i just go: Ctrl+Alt+F1, username, password, killall -9 nexuiz. Thanks again! Terminal rocks :D

Reply

49 Taqi Ahmed Taha April 26, 2010 at 5:23 pm

I have a PHP CLI script on a UNIX machine that gets terminated after some time.
How to check if a process is terminated ? where do i look for to check if the process received a termination message ?
The script is to run for about 5 hrs how do i achieve this.
i am currently using php script_name.php
I have read about nohup but is nohup immune to Kill command.
I think someone either the administrator or the OS is killing the process. Is this possible, if so how do i stop this and make my script run for longer time.

Reply

50 lowell May 12, 2010 at 6:23 pm

“As I said earlier killall on UNIX system does something else. It kills all process and not just specific process. Do not use killall on UNIX system (use kill -9).”

This is inaccurate.

Mac OS X, one of the nine certified UNIX03 (which, despite the designation, is the current standard) operating systems, uses an implementation of killall which behaves as it does in Linux.

I’m not pointing this out to be pedantic, it saves keystrokes over the “(find the process’ #pid) `kill -9 #pid`” routine.

Reply

51 Kaustubh May 21, 2010 at 2:29 am

How do i kill a program, cleanly. I used killall on transmission, but everytime it starts, it goes on to verify the files. Thanks.

Reply

52 chrysa May 26, 2010 at 2:45 pm

how can i kill ‘inside a script’ my other terminal (having open 2 terminals) and find which is the other one too.????tnx :)

Reply

53 Ganesh June 18, 2010 at 1:34 pm

I am using sify internet. they provided one 24online client software for login. it is binary which directly run with help of user name. when 1st time I tried it asks me dns. It create conf file and I got massage that I logged in. for week I used same command like: ./crclient -u xyz123 and I get connected to internet. one day I was connected to internet lost connection due to electricity. I use to logout command like ./crclient -l. I tried to login and getting massage that
already logedin process id 2951. if I see process using ps -el of pgrep 2951 there is no process. I tried many things like shut down pc. reboot, kept for week off, but still same massage comming from. also I tried to do like install again. I could not understand if there is no process running then why it is saying that it is running. can any one help to stop it.
How to find out which process is not running?

Reply

54 nixCraft June 18, 2010 at 2:43 pm

It may be using pid file stored in /var/run directory.

Reply

55 Nabil M June 23, 2010 at 5:58 pm

kill -9 `ps ux | awk ‘/java/ && !/awk/ {print $2}’`

replace the word java with wather is your process name

Reply

56 Peter July 25, 2010 at 11:47 pm

There are two types of processes kill can’t remove: Immortal and Zombie, as explained in this note:

http://www-cdf.fnal.gov/offline/UNIX_Concepts/concepts.zombies.txt

For those who don’t read technical stuff well, it basically says, iirc, a zombie is a child that has died, but not yet reaped by its parent. It uses no resources other than its process entry. Since the zombie is essentially dead, it cannot be killed again. If the parent itself dies before reaping the zombie, the child becomes an orphan and reparented to ‘init’ (the parent of almost all processes). When init waits for its children to die, it will also reap orphaned and its own zombie processes. Zombies are therefor dead processes waiting to be reaped by their parent/init. They should not exist for very long, seldom long enough for ps to list them.

An Immortal process is one that cannot be signalled because it has a priority higher than the signaling threshold: It won’t get signals sent by kill. Processes that use system critical resources (such as a disk drive) are temporarily given higher priority and therefore cannot be killed while accessing those resources. If the process waits for input from the resource, such as ‘transfer completed’, which never arrives because the devices was removed (for example), then the process can wait forever and becomes Immortal.

Now, if the parent is an Immortal process, and its child dies (either naturally or via the kill command), the child becomes both a zombie and immortal. It cannot be killed because it is already dead, it exists to be reaped. Its parent will never reap it and can’t be killed because it is blocked by system critical resources and won’t get any signals. Neither can init reap the zombie as an orphan because the parent still exists, and, kill can only kill live processes, not dead ones, so it can’t remove the zombie. Neither can kill remove the parent because the kernel (linux) won’t pass signals to it.

The only solution in this case is to reboot.

The difference between a respawned process (one that re-appears after being killed) and a zombie, is that the respawned process will (normally) have a different pid, while the zombie pid will always be the same. If it is a zombie, then the parent should reap it, otherwise go after the parent (ppid). If init is the parent and not reaping the zombie, it probably isn’t healthy and needs attention.

The difference between a Zombie and an Immortal process is that the zombie is dead and holds no resources, while an Immortal process has a high priority that prevents it from getting signals, is alive, and holding/consuming resources. Both zombie and immortal processes retain their pid after being ‘killed’.

Mostly, kill works just fine to remove buggy programs, but its the stubborn zombies and (more importantly) immortals where kill fails. I suspect the reason is that kill does not actively kill anything, but passively sends signals, assuming the target will ‘do the right thing’. For zombies and Immortals, they can’t or won’t. Apparently there is no nuke to smash these processes and mark all their resources as ‘available’. Perhaps a reboot is safer than risking the kernel screwing up its resource allocations and (silently) trashing system/user data?

I did find your article informative, the pidof with kill is exactly what I’ve been looking for. The answer to killing zombies and immortals is not what I wanted, but at least I know I’m not missing something (am I?).

Reply

57 vadivel September 24, 2010 at 6:20 am

hai,
i am first time using linux,please tell me all the commands for linux and main usage for current process for killing.

Reply

58 Ilias October 29, 2010 at 8:37 am

Hello!

Anyone knows how to kill all the processes from a specific username from TOP command? Usually you have to indicate the PID, but i would like to kill all the PIDs from a user.

Thanks!
Ilias

Reply

59 Vamsi November 28, 2010 at 12:02 pm

Nixcraft rocks :D

Reply

60 robby November 29, 2010 at 5:39 am

thanks mathew for pstree -p |grep process_name

Reply

61 mocca January 23, 2011 at 4:02 pm

what is the differences between unix process and signal?
can you give an example please..

Reply

62 Abcdef Genie February 11, 2011 at 7:58 pm

Yessss. Finally got all my 40 apache2 processes to kill themselves. :) Thanks.

Reply

63 LA February 14, 2011 at 11:51 pm

Can anyone tell me how to kill users who are logged into the terminal (I.E.: tty), I currently show eight users logged in and there is only one profile besides root. There should not be eight users. I have one terminal open. Thanks for your help.

Reply

64 Rohit February 28, 2011 at 5:14 am

Hello i not able to get the PID of the process which i need to kill.
I used pidof (process name),ps -A ,top command but i not got pid of the process

Reply

65 Soundarapandian July 22, 2011 at 12:47 pm

Thank You.Very useful :)

Reply

66 abhishek dilliwal September 15, 2011 at 10:11 am

great compilation buddy it helped… its man pages in simple way… thanks anyways

Reply

67 rajendra pandey September 20, 2011 at 2:17 pm

i wanted to know could i use kill -9 -1 command
To kill the Process ID in UNIX

Reply

68 davea0511 September 24, 2011 at 7:46 pm

Nabil –

You are a total stud. That’s what I was looking for … the only way to kill a process by name (not PID number) that worked.

For those who didn’t get it the first time…

kill -9 `ps ux | awk ‘/java/ && !/awk/ {print $2}’`

Then replace the word java with wather is your process name.

I used this to kill chromium gracefully (with a kill -15), then restart it 5 seconds later … that gets rid of the pesky “Chromium didn’t shut down correctly” message.

Reply

69 Reji November 11, 2011 at 10:24 am

Very nice site.,great explanation

Reply

70 sathiyanarayanan November 26, 2011 at 6:14 pm

For what purpose we use -9 option in kill command , what is the difference between kill and kill -9 .

Reply

71 Kaja December 30, 2011 at 9:34 pm

This so helpful! Thank you :). I used to use command sudo killall skype and wondering why it did not work haha.

Reply

72 sathiyanarayanan January 3, 2012 at 4:51 am

Hi Friends i know how to kill process , but -9 option for what purpose we are using , how to clear zombie process in process tables ?

Reply

73 nobody February 9, 2012 at 9:05 pm

in a shell, press strg+c to stop (e.g. if you started an extraction that should have been started as root, but you started it as user)

Reply

74 niro February 21, 2012 at 6:54 am

pidof firefox | xargs kill

love it

Reply

75 powerpawn March 6, 2012 at 1:23 am

Hey guys! I have a process that changes PID every time I kill its parent. I have also tried the process itself. The conditions are:
I am using screen
The process is being used but wont tell me whats using it even if I try a ps afx

Any help would be wonderful as it is taking up a important port on the server and I cant run any other programs with it on that port. Thanks!

Reply

76 Jagadish March 17, 2012 at 9:34 am

Hi,

I have a requirement like killing some 20 to 30 process from linux. suppose if i want to kill a single process i will use kill -9 . Is there any way to proceed on killing multiple process related to same instance.

Note: in the same linux server i have 3 Oracle Instances are running.. NO other instance should be affected for this.

Can anyone help on this.?

Regards,
Jagadish.

Reply

77 chacha April 11, 2012 at 6:25 pm

Hi all!,
I like your comments .
i am running a MIP model using glpk package in Ubuntu terminal,but i got the text killed at the end.
what should i do .i’m usinng a matrix dimension of 95×95.
when using matrix dimension 40×40 the package works successfully.
help please!

Reply

78 chacha April 11, 2012 at 6:28 pm

note that i am using 32bit windows
2RAM,

Reply

79 sashenk May 26, 2012 at 2:03 pm

Hi,
I’m wondering how to kill a tcp connection by entering the connection PID.Please help me.

Reply

80 thulasi June 1, 2012 at 12:42 pm

may i know how to kill a unknown pid.
while entering ps command it is showing that login details but the program is running on another telnet in that the program is in middle ,it is stucked .can you please suggest some one..

Reply

81 Chika Tambun June 27, 2012 at 1:50 pm

[root@elang ~]# yum update
Loaded plugins: fastestmirror, security
Existing lock /var/run/yum.pid: another copy is running as pid 4562.
Another app is currently holding the yum lock; waiting for it to exit…
The other application is: yum
Memory : 44 M RSS ( 86 MB VSZ)
Started: Wed Jun 27 06:05:35 2012 – 00:01 ago
State : Uninteruptable, pid: 4562

Exiting on user cancel.
[root@elang ~]# kill -9 4562
[root@elang ~]# ps aux|grep yum
root 4562 0.0 7.9 87792 44764 pts/1 D+ 06:05 0:00 /usr/bin/python /usr/bin/yum update
root 4792 0.0 0.1 4016 676 pts/2 R+ 06:05 0:00 grep yum
[root@elang ~]#

Reply

82 newbie September 20, 2012 at 12:42 pm

thanks, this article solved my problem

Reply

83 Hardik October 9, 2012 at 6:33 pm

Hey i want diffrent multipal pid Of Firefox Bcz I want Close Only ne window(Not Tab) of Firefox
Plz…..
ans Me as Soon as fast

Reply

84 joseph October 11, 2012 at 3:02 pm

Thaks..its very funny all this ..killall.
..its sound to kill em all..like the clasic metallika disk..sorry,i rmember
the unix philosophy:“ unix:uniqie,only one way to do
.something…well,there many..amd thatts its funny too
by the way good post..its solve my problem too

Reply

85 Saravanan T March 19, 2013 at 2:24 pm

Hi Guys,
i need to know the process id of the last killed process and who killed the Process?. where i can get that?

please help me…

thanks,
Saravanan

Reply

86 tadag April 22, 2013 at 10:04 am

thank you for this. was easy to understand and apply.

Reply

87 Mudassir Aftab June 12, 2013 at 3:47 pm

Hi,

1. How can i kill 50 old pid’s of particular precess ?

2. How can i kill 50 old pid’s of particular process when it reached to 100 using cron ?

Thanks in advance.

Mudassir

Reply

88 Mudassir Aftab June 12, 2013 at 4:07 pm

How can i kill 50 old pid’s of particular process when it reached to 100 using cron script?
ps -elf | grep myscript | head -n 50 | awk ‘{print $4}’ |xargs kill -9

Mudassir Aftab

Reply

89 npn August 16, 2013 at 10:42 am

Don’t forget we also have `killall’ which will terminate processes by process name, by default with a SIGTERM.

Reply

90 sandeep June 8, 2014 at 9:45 pm

Hi,

I have a list of servers for example say 1 to 10
How would i able to see the process id’s for all at a time

Is there any command to get it

Thanks

Reply

Leave a Comment

Tagged as: , , , , ,

Previous Faq:

Next Faq: