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
Asked
Active
Viewed 2.9k times
2
muru
- 207,228
1 Answers
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.
insert_name_here
- 1,555