In Unix, why can't I kill certain background processes even with kill -9?
Occasionally you will have a process in Unix that you want to kill but cannot. This generally happens with SUID (Set User ID) processes, which are programs that assume (or allow assumption of, depending on particulars of the operating system) the file owner's UID when started. (Technically, the process's "effective" UID is set. The "real" UID is always yours.)
As soon as you run such a program, you no longer own the process. Many network-based applications run this way to take advantage of direct device access. This assumes that the user programs which have been SUID'd will behave properly and are written in a secure fashion.
Occasionally you will run into a situation where the SUID process does not behave properly. To kill a process like this, you must regain interactive control of the process or kill the parent process of the hung process.
To regain control of a backgrounded process, you need to bring the jobs
it is associated with into the foreground. List the jobs you have
running by entering the
jobs command at your prompt:
You should see output similar to this:
+ Stopped emacs19
- Running ping -l deathstar
To regain control of the
ping command use the
x with the number of the job in the
listing. Often, you will not need to include the
% (percent sign).
Once you have regained terminal control of the process, send an
interrupt to the process by pressing
Ctrl-c . This should
stop the process and return you to the shell. If it does not, try
sending a quit signal to the process by pressing
Note: Some programs, such as Pine and Emacs, will not respond to either of these signals, but typically have their own commands to stop their processes.
If neither of these control key sequences work, try stopping the
process by killing its parent process. On System V
implementations, which include all UITS
central systems, you can list your processes with parent
process IDs included by entering:
ps -fu username
username with your username.
The equivalent BSD command is:
This will list all of your processes and their process IDs (PID in the listing) and parent process IDs (PPID in the listing). Locate the original process you are trying to kill, and send a HUP (Hangup) signal to it. Do this by entering: kill -HUP <PPID>
<PPID> with the parent process ID.
If you've already detached the process (e.g., backgrounded it and
logged out), all you can do is hope that it runs into a problem where
it terminates itself (rather likely), or request the system
administrators to kill the process for you. At Indiana University,
you can notify the system administrators of the problem by posting to
ucs.system newsgroup or by sending email to
At Indiana University, for personal or departmental Linux or Unix systems support, see At IU, how do I get support for Linux or Unix?
Last modified on February 19, 2013.