Raspberry Pi: Shutdown & Reboot Safely – Command

If you don’t want to corrupt the file system on SD card, you should always shutdown and reboot Raspberry Pi correctly (not just by pulling the power cable out).

To shutdown or reboot Raspberry Pi safely through the GUI, simply search the menu for the corresponding buttons.

In this note i will show how to shutdown or reboot Raspberry Pi safely from the command line.

Cool Tip: Check the CPU/GPU temperature of Raspberry Pi! Read more →

Safe Shutdown: When RPi (or any other UNIX-like system) is shutting down or rebooting normally, using the commands from terminal or their GUI equivalents, firstly it tries to exit all processes gracefully by sending SIGTERM signal, notifying them to save their data and exit. After some time it sends SIGKILL to all remaining processes, unmounts all the file systems and finally tells the kernel to issue the ACPI power command.

Shutdown Raspberry Pi

Use any of the commands below to shutdown RPi safely:

$ sudo halt
$ sudo poweroff
$ sudo shutdown -h now
$ sudo shutdown -h 10 # in 10 minutes
$ sudo init 0

When the shutdown process has finished, the green LED blinks several times – after this it is safe to pull the power cable out.

If only the red LED is on, everything is good as it just indicates that the Raspberry Pi is connected to a stable power supply.

Reboot Raspberry Pi

Execute any of the following commands to restart RPi safely:

$ sudo reboot
$ sudo shutdown -r now
$ sudo shutdown -r 10 # in 10 minutes
$ sudo init 6

Turn OFF/ON Power Pin: The pins 5V, 3V3 and GND are directly connected to the power supply and can’t be controlled by software. For example, if on Raspberry Pi shutdown you also want to turn off the cooling fan connected to the 5V and GND pins – programmatically only this can’t be achieved.

One Reply to “Raspberry Pi: Shutdown & Reboot Safely – Command”

  1. Aristide Vanwanzeele says: Reply

    Is there any chance when using “sudo reboot” instead of “sudo halt” will corrupt the SD card or is “sudo reboot” also safe?

Leave a Reply