This is nice! On OSX, processes can be paused and continued too (by name via killall, and by PID via kill): kill -STOP 1234 kill -CONT 1234 killall -STOP -c "Pandora" killall -CONT -c "Pandora" A more nuanced control is to throttle down the CPU, via cputhrottle[1]. If I'm running a CPU-intensive calculation and don't want to bog down the rest of my system I will use it to give me enough cycles for Sublime Text to wor…
#!/bin/bash
currentProcess=$(xprop -id $(xprop -root | grep -F '_NET_ACTIVE_WINDOW(WINDOW)' | awk '{print $5}') | grep -F '_NET_WM_PID(CARDINAL)' | awk '{print $3}')
state=$(grep 'State:' /proc/$currentProcess/status | awk '{print $2}')
if [[ "$state" == "T" ]]
then
kill -CONT $currentProcess
else
kill -STOP $currentProcess
fi