Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

kill -9 -1

 
Mike Shn
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello
I always use the command to kill the process
kill -9 pid(process ID) .
Today on my Red Hat 7.3 box accidently typed
kill -9 -1 .. The monitor start blinking and everything freezed.
My questions is : What is the purpose of these commands:
kill -9 -1
kill -9
Thanks
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First, I'd caution against casually using "kill -9". This is the harshest form of "kill" and cannot be stopped. It's almost always better to try one of the other signals (typically using just "kill" rather than "kill -9") in the first instance, and only use SIGKILL (9) if you can't shut the errant process doen more cleanly (see "man kill" for more details).
Naturally, I don't want to try this on my system, but my guess is that the kill command parsed the -9 as the signal to send, then the following -1 as the process to kill. It may have stripped off the '-' and killed process 1. Process 1 is usually the "init" process which started all the other processes when the system booted up, and is a very bad thing to "kill".
 
Dave Landers
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Man page for kill sez
-1 All processes with pid larger than 1 will be signaled.
That includes just about everything. Wheee! Kerflump! Bzzzt!
If you did this as root, it'd kill the works (a bad thing). If you were a normal user, I think it would only kill the processes you owned. Still not a good thing, but would leave the system intact.
Try not to do that again
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic