Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

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)
        continue;

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. –  ultrasawblade Mar 9 '12 at 13:35

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.