Wednesday, December 27, 2017

How to kill by name from the command line - ubuntu 17.10

Ubuntu Tip

The pain


So I am working on coding a react and redux component and I have a tight loop spinning in chrome. Chrome becomes unresponsive and won't stop. Soon it will eat up all the system memory and cause my machine to grind to a halt. For some reason chrome rarely detects the rapid resource growth.

I used to open  a terminal and run

$ ps -A

to look up chrome's pid but chrome has many pids one for each window and ne per extension. My machine is slowing. I next try:

$ ps -A | grep chrome

this is better, I choose the first pid (I might have to scroll) and

$ kill -9 <pid>

And thing go back to normal. But I still haven't fixed the bug and  there has to be a better way...

The remedy

$ killall -9 chrome

and this kill all chrome processes - one command and no lookups copy pastes etc.

Note 

Probably nothing ubuntu 17.10 here ....