Linux Commands

How to Shut Down Your Linux System

Shutting down a Linux system safely is beneficial since it helps protect your data, which may damage in case of improper shutdown. When you securely perform the shutdown, the system will be notified that it will go down soon and stop all the processes and services running on the system before the shutdown. You may also get approval to stop those services and in case of any important service running, you can skip the shutdown.

This article will show you different ways to shut down the Linux system safely.

How to Shut Down Your Linux System

There are different Linux commands you can use to shut down the Linux system, which are as follows:

Command 1: Shutdown Linux System Through “shutdown” Command

The “shutdown” command is one of the most widely used commands in Linux systems that can safely shutdown the system.

The fundamental syntax to use this command is given below:

$ sudo shutdown

If you apply the above command directly, it will schedule the shutdown time and within 1 minute, it will automatically shut down the Linux system.

You can cancel the shutdown anytime using the following command:

$ sudo shutdown -c

If you want to immediately shut down your Linux system without waiting, you can use the following command:

$ sudo shutdown now

You can also set the timer for the shutdown as well using the following syntax:

$ sudo shutdown <Time>

If you want to shut down the Linux system after 5 minutes, you can run the following command:

$ sudo shutdown 5

In case if you want to schedule a time for a specific hour, you can schedule the time accordingly. Like in my case, I want to shut down the system at 8 pm. For this reason, the command will look like the following:

$ sudo shutdown 20:00

If your Linux system is accessed by multiple users simultaneously, it’s better to broadcast a message to notify them about the shutdown time. You can do this on a Linux system using the following command:

$ sudo shutdown <Timer> “Message”

Command 2: Shutdown Linux System Through “halt” Command

You can also use the “halt” command to shut down the system. If you directly apply the “halt” command, it will instruct the hardware to stop the CPU function.

$ sudo halt

However, if you want to shut down the system immediately, you can apply the following command:

$ sudo halt -p

Command 3: Shutdown Linux System Through “poweroff” Command

The “poweroff” command can also be used to shut down the system as it sends the signal to power down the system processor. The “poweroff” command immediately shuts down the system as soon as you execute the command in the terminal:

$ sudo poweroff

Conclusion

Linux users can easily shut down the system from the terminal using the “shutdown” command, which can be used in different ways already discussed in the above guidelines. The users can also apply the “halt” command to stop the CPU functionality and shut down the system. Further, the “poweroff” command can also be used to shut down the Linux system immediately.

About the author

Awais Khan

I'm an Engineer and an academic researcher by profession. My interest for Raspberry Pi, embedded systems and blogging has brought me here to share my knowledge with others.