Link to home
Start Free TrialLog in
Avatar of everactive
everactive

asked on

killall or pkill?

Hi,

Which one should I use:

killall -u username1, username2, usernameN...

Or:

pkill -u username1, username2, usernameN...

Thanks.
SOLUTION
Avatar of jghelfman40
jghelfman40
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Avatar of woolmilkporc
woolmilkporc
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Well you could easily do a loop, as well, if you wish to use killall. The same could be said for pkill.

for i in user1 user2; do killall -u $i; done
Avatar of everactive
everactive

ASKER

But will pkill kill all the users that are not exactly matched?

Example:

pkill -u john, mike;

johnny processes will be killed as well?


No, they won't.
Neither pkill nor killall can do that.
Sorry, can't watch videos on my mobile.
I'll wait :)
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Yep,

except for the fact that you can't give killall a comma-separated list of userids with the -u flag.

wmp
Ah, good point.  I forgot that killall -u only takes a single user.