Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

From my understanding of killall name is that it looks up all processes which name is name. So killall killall should lookup and kill itself, so I expected no output. So I'm curious:
Why does it look like that:

nathan:~ max$ killall killall
No matching processes belonging to you were found
nathan:~ max$ 

I'm on current OS X.

share|improve this question
up vote 5 down vote accepted

Per the Linux man page killall won't kill itself.

Edit: I see this isn't mentioned on the OSX man page but it probably has the same behavior. Reason being is that you can use regexps so it's entirely possible you might accidentally try to kill killall when specifiying a regex, and that would make killall less useful.

Edit 2: I might be wildly wrong about this, but isn't OSX called "Darwin" - and isn't this the source code to OSX killall then?

I'm a bit rusty on my C, but the following:

  if (thispid == mypid)

in what appears to be a loop iterating through all active processes seems to be a specific check to compare the current process it's trying to kill against it's own PID, so it will skip itself.

Guess you could download that source, remove those two lines, and recompile it if you really wanted a killall that would kill itself.

share|improve this answer
Can you tell me on which man page you found it? – Max Ried Mar 9 '12 at 6:51
The OSX man page doesn't mention this but the Linux one does. Might have to check the source code but I would bet they'd act the same way. – LawrenceC Mar 9 '12 at 13:35

You must log in to answer this question.

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