Safely Shutting Down / Rebooting your Raspberry Pi


Well the most easiest way to shut down any computer is by pulling the plug or to switch it off directly. As with most of the PCs they can be switched off forcibly even when the system has crashed by holding the power switch for 3 secs. But this method isn't quite healthy for your system as it can damage the HDD or BIOS. For the Raspberry Pi, it can cause problems or corrupt the SD card.

So now let’s talk about how to shut down your Raspberry Pi when it hasn't frozen.

sudo shutdown -h now (or sudo halt)  [-h means halt the system] [now means to shutdown immediately]

You can also use the shorthand's:- `halt` and `reboot`.


Remember that you will need sudo privileges to  use shutdown (or halt)

When the shutdown command is entered it sends out a message to all logged in users
“The system is going down for system halt NOW!”
If you want to reebot your system simply replace the -h with -r 
sudo shutdown -r now (or sudo reboot) [-r means reboot the system] [now means to shutdown immediately]

Now for cases when your system is not responding or frozen,ssh comes in handy.By using a ssh client on another computer within the same network start an Xterm console window and enter the given commands..
sudo shutdown -h now (or sudo halt) OR
sudo shutdown -r now (or sudo reboot)
Your ssh session will terminate as the system is shutting down.

2 comments