Example use case:

I run Chromium with a couple of tabs open and decide that I don't need to access the application for the next 20 minutes. In order to conserve laptop battery time, I would like to hibernate (freeze) Chromium without having to close the application (re-opening and re-loading all tabs requires time that I would like to save by hibernating it).

  • 1
    Check second answer here: stackoverflow.com/questions/2134771/… . The thing is that chromium is using many PID's and those are different every time you open it... but stopping main one (the one with original icon in process manager) seems to be working fine. – GreggD Apr 17 '16 at 14:22
  • 1
    If you only care about Chromium and not any other applications, you could use a Chromium Extension designed for tab management, such as OneTab or Session Buddy. – Moshe Katz Apr 21 '16 at 20:36
  • Thank you but I find the killall solution actually really elegant. :) – orschiro Apr 22 '16 at 6:18

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.

  • 4
    Since you started with pgrep, you could have continued with pkill – muru Apr 17 '16 at 14:38
  • 1
    Though the risk of the application crashing from SIGSTOP exists, I would say it is minor. I have often used it on Chromium, and I don't recall that ever being the reason for a crash. – kasperd Apr 17 '16 at 20:56
  • I've learnt smtg new! killall! ;-) – Fabby Apr 19 '16 at 18:23

To suspend, try: killall -SIGTSTP chromium-browser

If this does not work, try the forceful version: killall -SIGSTOP chromium-browser.

Either way, to continue use killall -SIGCONT chromium-browser. I tried with Firefox and it worked. Do note however, that if you click buttons in Chromium while it is suspended it will execute that stuff once you continue it's execution.

  • 3
    SIGSTOP/SIGCONT works for me, just need to enter chromium-browser as process name. +1 – GreggD Apr 17 '16 at 14:33
  • 1
    Or google-chrome if you use Google Chrome, since the difference is apparently confusing – cat Apr 17 '16 at 22:41

You can try the following (in a Terminal):

ps aux | grep gedit

Then you'll see something like this:

barend    7166  5.3  1.0 722620 39044 ?        Sl   16:19   0:00 gedit

Write down the number 7166 (or whatever number it is) and then do:

kill -STOP 7166

That will suspend execution of the process. It won't immediately free the memory used by it, but the memory will be available for other processes if they need it.

Then do

kill -CONT 7166 to work with the program again.

Note that you have to change 7166 where appropriate.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.