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"
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):
It's not shutdown, anycase take a look at the following command:
From man page: