Duke University
Center for the Study of Aging and Human Development

     
       
Home Page

Computing & Statistics Lab

            How to Kill an Unwanted Process on a UNIX System
 
     There may come a time when you have an unwanted process running on 
the UNIX system - perhaps a runaway SAS job or a leftover email connection 
from another computer. Here is how you can kill such a process.
 
1. Enter the command 'ps -ef | grep username' where 'username' is your
   own login id. Here's as example:
 
===================================================
irv@gerisparc> ps -ef | grep irv
    irv 16485   243  0 08:04:45 ?        0:03 imapd
    irv 22149   243  1 12:46:22 ?        0:00 imapd
===================================================
 
    The first column of the output is your user id; the second column is 
your process id number; the fifth column is the time the process started; 
and the last column is what that process is doing. In this case user 'irv' 
has 2 processes running the imap daemon, reading email, and the earlier 
process will lock the email file, preventing the later process from 
reading it.
 
2. Next enter the command 'kill -9 process_id' using the id of the process
   you need to get rid of. This example would kill the earlier email 
   process, freeing up the email file to be read by the later process.
 
irv@gerisparc> kill -9 16485
  
   Only a system administrator can kill another user's process. A normal
user can only kill his or her own.

  
About Us | Weekly Bulletin | Center Report | People | Research | Education | Service | Pepper Grant | Links | DUMC | Duke
Copyright 2004 Duke University Center for the Study of Aging and Human Development

Questions or Comments? Contact Webmaster