Raspberry Expert is reader-supported. When you buy through links on our site, we may earn an affiliate commission at no extra cost to you.

How to Safely Shutdown Raspberry Pi

shutdown raspberry pi

If you are reading this article, presumably you might have faced some issues with your Raspberry Pi due to improper shutdown. Or you are interested in learning the proper methods to shutdown Raspberry Pi from terminal. Anyways, you have come to the right place because in this article I will show how exactly you can shut down or power off your Pi without having any issues.

Since Raspberry Pi does not come with a native power button, your very first instinct is most likely to pull the power cord to turn off your Pi. But I highly recommend you to avoid this as it can cause dire consequences. By doing this, there is a high chance of corrupting the data on your SD card and file system.

Furthermore, if anything is running it won’t make a graceful exit and save. That means when you pull the power cord suddenly before halting your system, it is considered as a forced exit and it may cause serious data loss depending on what your Pi was running at that time.

So, at any cost avoid this practice and do the methods which I’ll show you in a minute.

How to Shutdown Raspberry Pi?

For keeping your board and its file system safe, your Pi should get a clean shutdown. There are a few efficient methods for doing this. They are as follows:

1. Using Raspberry Pi Shutdown Command

If you have a keyboard and a screen, then the easiest method to safely stop a Pi is using a simple command for the shutdown. For this, you need the superuser do (sudo) or power user privilege. But do not fret about it, the default raspberry pi user has such privileges unless you’ve drastically modified your user configuration.

The Raspberry Pi shutdown command is:

sudo halt

The above command is a shorthand for the following (use any one of these):

sudo shutdown -h now


  • sudo – To run its following command as superuser or admin.
  • shutdown – The command to shut down Raspberry Pi.
  • -h – To halt the system after shut down (and do not reboot).
  • now – This means to do it straight away. You can also add a number like 10 to shut down in 10 minutes. You can even give a specific time (in 24-hour format with a colon) at which the system should be shut down. For example, 17:25 will shut it down at 17:25.

Basically, when the command is issued, it will send the SIGTERM signal to all the running processes. This allows the running programs to save and exit gracefully. (The SIGTERM is a generic signal used to terminate the programs)

Subsequently, it sends the SIGKILL signal to cause immediate termination of any remaining processes. (SIGKILL is a signal used to cause immediate program termination) And finally, it will unmount all file systems and you can then pull the power cord safely.

2. Using Raspberry Pi Reboot Command

This is another method that can be used if you wish to shut down and then automatically reboot your Pi. This command-line method also needs the sudo privilege, and the command is as follows:

sudo reboot

The above command is a shorthand for the following (use any one of these):

sudo shutdown -r now


  • sudo – To run its following command as superuser or admin.
  • shutdown – The command to shut down Raspberry Pi.
  • -r – To reboot the system after shutting down.
  • now – To do it now. (same as in the shutdown command)

3. Shutdown Raspberry Pi from Desktop

Shutting down a Raspberry Pi graphically is pretty straightforward if you have a monitor connected. Simply click the Menu from the desktop and then choose shutdown as in the screenshot below. Also, this is a method to shutdown raspberry pi without keyboard.

shutdown raspberry pi

Alternately, you can create a Raspberry Pi shutdown button or safe shutdown switch to properly shutdown Raspberry Pi easily. I will cover this tutorial in the future with detailed instructions and screenshots.

4. How to Shutdown Raspberry Pi Remotely (Via SSH)

This is another method you can use to safely shut down your Pi remotely. Here we use the Secure Shell Protocol to control your Raspberry Pi. For using this method, you need to do the following:

For doing each of the steps below, I’ve written a separate detailed guide. You can click on the links to go to the respective articles and come back to proceed with the rest of the steps.

  1. Make sure that SSH is enabled on your Pi.
  2. Find your Raspberry Pi IP address.
  3. SSH into Raspberry Pi.
  4. Shutdown Raspberry Pi using any one of the following commands:
sudo halt
sudo shutdown -h now
sudo shutdown -r now

How to Turn ON Raspberry Pi After Shutdown?

It’s a piece of cake! Turning your Raspberry Pi ON is a simple task. For this, all you need to do is simply plug the USB power cord into the port of your Pi.

That’s it.

You may also like: Multi boot Raspberry Pi using BerryBoot.

Final Words

Hopefully, from now onwards you won’t pull the power cord anymore to shutdown Raspberry Pi. 😀

I’ve tried my level best to explain things clearly and I sincerely hope you got some knowledge from today’s article. If you have any doubts or queries feel free to drop a comment below. Also, let me know your thoughts regarding this article too.

Found an issue with this article? Report it here, so that I can resolve it.

About the Author: Vishnu Mohan

Vishnu Mohan is an ardent hobbyist of Raspberry Pi projects, who hails from God's Own Country. He is kind of a minimalist person who believes in keeping things simple & elegant in life. Apart from the techy things, he is passionate about music and cricket. In his free time, he likes to read books and spend quality time with his family and friends.

You May Also Like

Leave a Reply

Your email address will not be published.