Paul's answer is functional, and is in fact what I started with. But as the OP notes in a comment, it's not very user-friendly.
tl;dr: Another option is to renice
processes.
My current situation was caused by a web page and chrome not playing nicely (the web page has a bug I was inspecting, and saw there were over 100K nodes in a drop down option list, but went ahead and clicked the "see all" button, knowing it would probably cause badness). I started with CTRL+ALT+F6
, then after logging on, double-checked that there wasn't some other issue by running top
, and seeing PyCharm was using more processor time than Chrome, I ran
ps auwx | grep -i chrome
to take a look at the chrome instances. I was going to just use killall
to close all the chrome instances, but as I was refreshing my memory on killall via man killall
, I decided to check out some of the "see also" programs:
SEE ALSO
kill(1), fuser(1), pgrep(1), pidof(1), pkill(1), ps(1), kill(2), regex(3).
I took a look at man pkill
, which also gives info for pgrep
. In the examples section was this helpful bit:
EXAMPLES
<snip>
Example 4: Make all netscape processes run nicer:
$ renice +4 $(pgrep netscape)
I knew about renice
, but it had been a long time since I'd had to use it, so I had forgotten about it. I checked the output for what I thought I wanted with:
pgrep chrome
and saw it wouldn't match anything I didn't want it to. I then ran:
renice +4 $(pgrep chrome)
When I switched back to the desktop (CTRL+ALT+F7
) this allowed me to actually interact with the browser and kill the one offending window (IDK if it would have worked for just one tab, but in my case they were one and the same), leaving the other 44 chrome processes running. The level of niceness needed probably depends on how borked your system is.
While this isn't "my 80-year-old dad could do it" friendly, it at least avoids a system reboot, and avoids killing more than necessary. Some things to note about niceness, from man renice
:
NOTES
Users other than the superuser may only alter the priority of processes they
own. Furthermore, an unprivileged user can only increase the ``nice value''
(i.e., choose a lower priority) and such changes are irreversible unless (since
Linux 2.6.12) the user has a suitable ``nice'' resource limit (see ulimit(1) and
getrlimit(2)).
The superuser may alter the priority of any process and set the priority to any
value in the range -20 to 19. Useful priorities are: 19 (the affected processes
will run only when nothing else in the system wants to), 0 (the ``base'' sched‐
uling priority), anything negative (to make things go very fast).
Also note that you can renice
from within top
by pressing r
while viewing processes.