[ Home  |  FAQ-Related Q&As  |  General Q&As  |  Answered Questions ]


    Search the Q&A Archives


...difference bet. kill-15, kill-9 and other kill...

<< Back to: Unix - Frequently Asked Questions (1/7) [Frequent posting]

Question by hari
Submitted on 7/14/2003
Related FAQ: Unix - Frequently Asked Questions (1/7) [Frequent posting]
Rating: Rate this question: Vote
what is the difference bet. kill-15, kill-9 and other kill commands in UNIX?


Answer by ladypine
Submitted on 2/21/2004
Rating:  Rate this answer: Vote
kill accepts several signals. Use kill -l to see all the signals on your system. The meaning of each signal depends on your system, though usually kill -9 is kill -KILL, which is a killing that cannot be caught and ignored by the killed process.

 

Answer by lj
Submitted on 7/4/2005
Rating: Not yet rated Rate this answer: Vote
'kill' is a bit of a misnomer: it actually means 'send a signal to a process'; this signal may not actually kill it.

The most common signals for killing a process:

-TERM (15)
The process is requested to stop running; it should try to exit cleanly
-KILL (9)
The process will be killed by the kernel; this signal cannot be ignored.
-SEGV (11)
'Segmentation Violation':The process has committed a GPF and will be killed by the kernel; this signal cannot be ignored.

If you have a misbehaving process, try to kill -TERM it, so it can save any data it's working on. Using -KILL (kill -9) on a program should be a last-resort, as the program will be killed immediately, and may leave the data it's working on in a corrupt state.

Other signals that are comminly sent with kill:

-HUP (1)
'hangup': The terminal the program is displaying in has been closed. This kills programs like bash when you close the window. Many daemons (which have no terminal to close) interpret this signal instead as an instruction to reload their configuration files.
-USR1
-USR2
'user-defined': these signals are not used by the operating system, so programs are free to use them for their own purposes.

 

Answer by ben
Submitted on 7/23/2006
Rating: Not yet rated Rate this answer: Vote
A kill -15 will send the program a SIGTERM command, if it has been written correctly it will recognise this and try to shut down the process cleanly - a kill -9 will basically kill -kill the process and should be used as a last resort.

 

Answer by jackblack
Submitted on 9/8/2006
Rating: Not yet rated Rate this answer: Vote
kill -15 <pid> send the SIGTERM signal to the process with the given id, but kill -9 send the SIGKILL signal.

SIGTERM can be handled by a program.
Thus, the programmer can choose to which
action he would like the process to take
when that signal is received.

SIGKILL can't be ignored, and can't
even be handled. It tells the kernel to
kill the process.

 

Answer by Rajeev
Submitted on 3/13/2007
Rating: Not yet rated Rate this answer: Vote
kill -15 <pid> (or kill -TERM <pid>) can be catch by the signal handler. Programmer can write a signal handler to catch this signal.

On the other hand kill -9 <pid> (or kill -KILL <pid>) can not be catch by the signal handler. This will send direct this command to operating system to kill the specified process.


 

Your answer will be published for anyone to see and rate.  Your answer will not be displayed immediately.  If you'd like to get expert points and benefit from positive ratings, please create a new account or login into an existing account below.


Your name or nickname:
If you'd like to create a new account or access your existing account, put in your password here:
Your answer:

FAQS.ORG reserves the right to edit your answer as to improve its clarity.  By submitting your answer you authorize FAQS.ORG to publish your answer on the WWW without any restrictions. You agree to hold harmless and indemnify FAQS.ORG against any claims, costs, or damages resulting from publishing your answer.

 

FAQS.ORG makes no guarantees as to the accuracy of the posts. Each post is the personal opinion of the poster. These posts are not intended to substitute for medical, tax, legal, investment, accounting, or other professional advice. FAQS.ORG does not endorse any opinion or any product or service mentioned mentioned in these posts.

 

<< Back to: Unix - Frequently Asked Questions (1/7) [Frequent posting]


[ Home  |  FAQ-Related Q&As  |  General Q&As  |  Answered Questions ]

© 2008 FAQS.ORG. All rights reserved.