Previously, I used sudo shutdown -h now to power off macOS. Upon powering on after this, the system would restore all the apps (like Chrome, VS Code, PDFs) to their previous status before shutdown.

Now, I used the same command sudo shutdown -h now to power off Ubuntu. But, upon powering on, the system starts an absolutely fresh state, without restoring the apps to their pre-shutdown state.

What's the functionality that macOS used? Can I use it on Ubuntu as well?


It is called "session management"

Could I have it on ubuntu?

Not in a default desktop

But you can use the Linux window session manager or Gnome Window Session Manager extension for gnome for this. You will get an indicator on the Gnome Shell top bar where you can save and restore a session. Installation from the 2nd link (1st one has a similar setup):


  • Make sure you have nodejs installed (e.g. execute node -v and if there is no output install it).

  • Install lwsm via npm: npm install -g linux-window-session-manager (on some systems you might want to use sudo)

  • Download or clone repository and move all files to /home/your-user-name/.local/share/gnome-shell/extensions/lwsm@johannes.super-productivity.com

  • In some cases - especially when you're using nvm, you might need to configure the path to your lwsm installation (which you can find out via which lwsm after a successful installation) extension via gnome-shell-extension-prefs.

Installation after setup is done:

cd tmp
git clone git@github.com:johannesjo/gnome-shell-extension-window-session-manager.git
mv gnome-shell-extension-window-session-manager ~/.local/share/gnome-shell/extensions/lwsm@johannes.super-pro

It's not shutdown, anycase take a look at the following command:

pm-action - Suspend or Hibernate your computer

pm-hibernate [--help]
pm-suspend [--quirk-*] [--help]
pm-suspend-hybrid [--quirk-*] [--help]

From man page:

These commands can be used to put the machine in a sleep state. The precise way how this
   is done can be influenced by installing executables and configuration snippets. For some
   options external programs are needed.

   These commands will usually be called by UPower or hald when triggered to do so by a
   program in a desktop session such as gnome-power-manager. Calling them from the command
   line is also possible, but it is not guaranteed that all programs in your desktop session
   keep working as expected.

       During suspend most devices are shutdown, and system state is saved in RAM. The system
       still requires power in this state. Most modern systems require 3 to 5 seconds to
       enter and leave suspend, and most laptops can stay in suspend mode for 1 to 3 days
       before exhausting their battery.

       During hibernate the system is fully powered off, and system state is saved to disk.
       The system does not require power, and can stay in hibernate mode indefinitely. Most
       modern systems require 15 to 45 seconds to enter and leave hibernate, and entering and
       leaving hibernate takes longer when you have more memory.

       Hybrid-suspend is the process where the system does everything it needs to hibernate,
       but suspends instead of shutting down. This means that your computer can wake up
       quicker than for normal hibernation if you do not run out of power, and you can resume
       even if you run out of power. s2both(8) is an hybrid-suspend implementation.

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.