You can use the killall
command to send a SIGSTOP
signal to all processes matching a given name to freeze them and later send SIGCONT
the same way to thaw them again.
First find out the process name using pgrep -l SEARCH_PATTERN
:
$ pgrep -l chrom
13010 chromium-browse
13036 chromium-browse
13038 chromium-browse
13153 chromium-browse
13166 chromium-browse
13169 chromium-browse
13175 chromium-browse
13187 chromium-browse
13195 chromium-browse
13206 chromium-browse
Note that it will trim long names, therefore the r
is missing. But this isn't a problem as you can use Tab completion to enter the process name which will complete it automatically.
Then you send the SIGSTOP
signal to all processes named chromium-browser
like this:
$ killall -s STOP chromium-browser
The Chromium window will grey out as if it became unresponsive. Well, it really became unresponsive, so that was to be expected. You can't interact with the window in any way now (except for the menu bar and minimizing etc. which is handled by the window manager and not the application itself). But the events from clicking buttons etc. are still generated and added to the application's event queue, so they will all be processed at once when you thaw the application again!
You thaw the application again by simply running this command that sends the SIGCONT
signal to the specified processes:
$ killall -s CONT chromium-browser
Sometimes freezing an application this way can cause it to crash, so make sure important stuff is saved before freezing an application.
In rare cases even the desktop environment/window manger/whatever else might become unresponsive as well. In this case you have to thaw the frozen application through a TTY:
Press Ctrl+Alt+F1 to switch to TTY1. You will be asked to log in, so enter your username and password. Then run the command to thaw the application the same way you would run it through your normal terminal emulator. After that switch back to the desktop (TTY7) using Ctrl+Alt+F7 and you should be fine again.
killall
solution actually really elegant. :)