2

What is the proper sudo terminal command to shutdown the computer gradually, saving everything, closing everything in the right order, and basically doing everything the computer needs to be doing to shutdown properly without any damage, in a safe manner just like you would shut down by clicking on the shutdown menu button with your mouse? I am asking for a command that shuts it down without any further actions, so the suggested gnome-session-quit --power-off is not a fit here.

And please give me one command, not a bunch of variants. Or if you do give me multiple options, please explain in which way they are different from each other.

terdon
  • 104,119
Zeno
  • 78

3 Answers3

1

I always used this

sudo shutdown -h now 

This

arranges for the system to be brought down in a safe way

For more information, refer to man 8 shutdown

Note that above, now is the current time and can replaced by -t sec 30, which means 30 seconds later. While the command is also working without, it is considered best practice to use -h (thanks Daniel and Bay Dam).

Cadoiz
  • 278
Bay Dam
  • 11
1

Clicking on the shutdown button with your mouse is equivalent to calling gnome-session-quit:

gnome-session-quit --power-off
muru
  • 207,228
0

Another option that worked for me is sudo systemctl reboot. This is also usable on all other distros using SystemD, such as e.g. OpenSUSE.

Works on any Ubuntu from 15.04, reference

Cadoiz
  • 278