Raspberry Pi

How to Shutdown Raspberry Pi Remotely

Raspberry Pi device doesn’t have a power off button to manually turn off the device, so in such cases, if there’s a problem with the device and the user wants to shut it down, they instantly think of taking out the plug to stop the power supply. But that is not an ideal way since it can damage the Raspberry Pi device or reduce its lifespan.

If you are using your Raspberry Pi device remotely either accessing the GUI or terminal, you must learn how you can shut down the Raspberry Pi device and, in this article, we will show you different ways to do the process.

How to Shutdown Raspberry Pi Remotely

There are multiple ways to remotely shutdown Raspberry Pi but for all these methods, you must enable SSH to ensure accessing the Raspberry Pi system remotely. Basically, SSH is a Secure Shell that enables users to access the Raspberry Pi system remotely from another PC or laptop.

Enable SSH on Raspberry Pi

There are several ways to enable SSH on Raspberry Pi, follow the article.

Shutdown Raspberry Pi

Once SSH is enabled for remote access to the system, you are good to use different shutdown methods. The methods differ from each other since there are two remote access mode for Raspberry Pi, which are:

The shutdown method for each mode is discussed as under:

Method 1: Shutdown Raspberry Pi Through GUI

If you are using the remote desktop environment through VNC or any other remote desktop application, you should learn to perform this method to shut down the Raspberry Pi device. In the GUI mode, you can easily shutdown your device from the application menu in the “Shutdown” section.

Click on the “Shutdown” button to remotely shut down the device.

Method 2: Shutdown Raspberry Pi Through Command Line

This method works for both cases whether you are using the Raspberry Pi desktop or only accessing the command line terminal. Shutdown can easily be performed through commands discussed below:

Command 1

One of the most used commands to shut down the Raspberry Pi system is mentioned below:

$ sudo shutdown

The above command will shut down the Raspberry Pi system within one minute. The user can alter the above command according to the needs; like if the users wants to instantly shut down the system then the above command can be used as:

$ sudo shutdown now

And if the user wants the system to shut down at some time, the same above shutdown command can be used along with some defined time limit:

$ sudo shutdown <Time>

Basically, the above command will schedule the time for the system to shut down.

If you have applied any of the above commands to shut down the system except for the “shut down now” command and want to change your mind, you can use the below-mentioned command to remotely cancel the shutdown process anytime:

$ sudo shutdown -c

The ”-c” flag in the above command is used to “cancel” the shutdown process.

Command 2

The halt command is another way to properly shut down the Raspberry Pi system. This command ceases all the functions of the processor and shutdown the system immediately.

$ sudo halt

Command 3

The “poweroff” command is another command used to properly power off / shutdown the Raspberry Pi system remotely:

$ sudo poweroff

Entering the above command will immediately power off the Raspberry Pi device.

Conclusion

Raspberry Pi system can be shut down remotely either from GUI or the command line. However, before performing the operation, you must enable the SSH service and ensure accessing the device remotely. Afterward, you can use the “Shutdown” option on the Raspberry Pi desktop to shut down the system through GUI. While, for the case of the command line terminal, you can use several commands like halt, shutdown, and power off to remotely shut down the Raspberry Pi.

About the author

Zahra Zamir

An Electronics graduate who loves to learn and share the knowledge, my passion for my field has helped me grasp complex electronics concepts and now I am here to share them with others.