Ubuntu – Is using the shutdown command to turn off the system safe

command linepower-managementshutdown

I have seen many articles and posts stating that a way to turn off the system via the terminal is issuing the shutdown -h now command. It obviously works on my system, but it shuts down everything extremely fast. If I power off the system using Ubuntu's GUI, the Ubuntu splash screen comes up, and it takes much more time before it actually powers down. By safe I am referring to a shutdown that makes sure all read/write operations are completed before powering down and avoiding data corruption.

So is using the shutdown command in the terminal actually a safe way to power off the system? If so, why does Ubuntu's shutdown menu take much longer to accomplish the same goal?

Best Answer

  • YES it is safe but...

    Shutdown does more than simply flush unwritten data from RAM to disk. In some installations it can be setup to run custom jobs:

    But as an answer here points out:

    The shutdown halt option (designated by shutdown -h in your question) does flush all the buffers and safely unmount the disks but it doesn't actually turn off the machine. To do that use:

    poweroff
    

    halt means flush buffers, unmount drives, close all processes in a graceful way. But not power off (though some systems may power off anyway). So the hardware is still provided with power.

    After halt a hard power off (pressing the power button or unplugging the power supply) will not damage the system, because it is already halted in a graceful way.

  • Related Question