2

what is the difference between kill -9 pid and kill pid command ? Do they have different behavior ? i know that -9 is for "SIGKILL" signal

1
  • If you don't specify a signal it will send SIGTERM (giving the process a chance to close itself down gracefully)
    – Zanna
    Jun 27, 2016 at 6:47

1 Answer 1

6

kill pid (which sends signal 15 (SIGTERM)) tells pid to terminate, but said program can execute some code first or even ignore the signal. kill -9 pid, on the other hand, forces the program to immediately terminate (it cannot be ignored).

You should always try kill pid first, as it allows the program to do things like saving/closing open files before exiting. Only use kill -9 when you need the program to close and it won't respond to a simple kill pid.

Not the answer you're looking for? Browse other questions tagged .