News for hackers. Stuff that matters.
Re:Bash Shell Awesomeness - Mass Killing Processes (On Ubuntu) by jgrahamc on Thursday August 06, 2009 @07:58AM (#745249)
You could just use killall.

http://linux.die.net/man/1/killall

Re:Bash Shell Awesomeness - Mass Killing Processes (On Ubuntu) by ap on Thursday August 06, 2009 @08:58AM (#745344)
... or use pkill:

  pkill -9 -U lusername
Unlike in Linux, in most unices killall(1) terminates all the processes
Re:Bash Shell Awesomeness - Mass Killing Processes (On Ubuntu) by lucumo on Thursday August 06, 2009 @10:44AM (#745555)
> Unlike in Linux, in most unices killall(1) terminates all the processes

Hehe... That reminds me of the day I learned that you shouldn't put . in your path, especially in the front.

It turns out that (old?) Red Hat machines had a script 'killall' in their /etc/init.d ...

Re:Bash Shell Awesomeness - Mass Killing Processes (On Ubuntu) by yan on Thursday August 06, 2009 @10:13AM (#745474)
God, that brings back memories of administrating Solaris boxes in high school. Once you reboot a primary web server twice, you never do it again.
Re:Bash Shell Awesomeness - Mass Killing Processes (On Ubuntu) by jacquesm on Thursday August 06, 2009 @08:03AM (#745264)
Hey, You're right! Never noticed that -u option.

I must use killall 100 times a day :)

Re:Bash Shell Awesomeness - Mass Killing Processes (On Ubuntu) by jgrahamc on Thursday August 06, 2009 @08:48AM (#745330)
Or you could ask ps to do most of the work for you:

  ps -u www-data -o pid --no-headers
That gives me just the PIDs of the processes run by www-data.
Re:Bash Shell Awesomeness - Mass Killing Processes (On Ubuntu) by jacquesm on Thursday August 06, 2009 @08:54AM (#745336)
Makes you wonder how much shell script code is written every year by people that have not yet cracked the manual on section '1'.

So much good stuff in there.

Good reminder to do a periodic review of that stuff, not all the options are easy to remember if you don't use them frequently enough.

Re:Bash Shell Awesomeness - Mass Killing Processes (On Ubuntu) by jgrahamc on Thursday August 06, 2009 @08:58AM (#745345)
Actually, I can never remember any of the options. I find myself doing man FOO all the time and usually work under the assumption that there's probably already an option to do the thing I'm trying to do.

Kudos to the original poster. That sort of combining of small tools is what the NIX command-line is all about.

Re:Bash Shell Awesomeness - Mass Killing Processes (On Ubuntu) by askorkin on Thursday August 06, 2009 @09:18AM (#745373)
Thats a great one as well, didn't even realise ps could do that