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

muru
  • 207,228

1 Answers1

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.