How to Shut Down Your Linux System?

In Linux, the system shutdown is a crucial activity carried out regularly. It is crucial because if the shutdown process is not performed properly, it may corrupt the data or damage the filesystem. To avoid this, a Linux system must be shut down properly, which closes all the running processes before proceeding towards the shutdown.

Considering its importance in view, this post will illustrate the best methods to shut down a Linux system with the following outline:

Method 1: Shutdown Linux System using CLI

Linux is a well-reputed operating system that can be easily or quickly managed through commands. This section describes the shutdown process of a Linux system using built-in command line utilities:

Using the “shutdown” Command

The “shutdown” command powers down the system properly in a secure way. When it is invoked, all the logged-in users know that the current system will shut down. Below are the examples to use the shutdown command

Example 1: Shutdown the System (Normal Mode)

The shutdown command without any option will invoke the shutdown process after 1 minute from the current system time:

$ sudo shutdown

The output displays the message for all the logged-in users that the above command scheduled the shutdown time, and after “1” minute (default time interval), it will shut down.

Example 2: Shutdown System Immediately

If you want to shut down the system immediately without waiting for the default time interval, then use the “+0” or its alias “now”:

$ shutdown now

Using the “hh:mm” Format

To schedule the time in hours, use the format “hh:mm”. Whereas the “h” stands for “hours” and “m” stands for “minutes”.

The command provided below will shut down the system at “2:30”:

$ shutdown 02:30

Example 3: Shutdown System at Specific Time

The “shutdown” command allows the users to shut down the system at the specified time interval. For instance, the command provided below will shut down the system after 10 minutes from the current system time:

$ shutdown 10

The above command will automatically shut down the current system after 10 minutes.

Cancel the Shutdown Process

To cancel the shutdown procedure, use the “-c” argument of the “shutdown” command in the following way:

$ sudo shutdown -c

As the above “-c” flag has been cancelled, the scheduled shutdown process of the current system.

Note: For more details on the shutdown, read our detailed article on the shutdown command.

Using the “poweroff” Command

The “poweroff” command line tool is also helpful to shut down the system as it instructs the system to power down all the system processes. It shuts down the system as early as the user executes this command.

The “poweroff” command can be used in the following manner to power off the system instantly:

$ sudo poweroff

The above command will shut down the current system immediately.

 Note: Only the “superuser” can stop the system process, or the user has “sudo” rights.

Using the “halt” Command

The “halt” command is another tool to shut down the Linux system immediately. This command generally powers off the system by telling the hardware to stop all the CPU functions.

However, it can be used with its “-p” flag to shut down the system immediately:

$ sudo halt -p

The above command will power off or shut down the system safely.

Method 2: Shutdown Linux System Using GUI

Although, the Linux system relies on the command line tools. However, various distributions support the GUI as well.

GUI of the system can also be used to shut down the system properly. As an example, this method is practiced on the GUI of Ubuntu 22.04.

A power button is displayed on the top right corner of the menu bar. Clicking on it will display a dropdown as shown below:

Move on to the highlighted “Power Off/Log Out” from the list and then select the “Power Off” option from the list:

After clicking on the “Power Off” option, a confirmation box will pop up. Click on the “Power Off”:

Doing so will shut down the system.

Conclusion

The “shutdown” and “poweroff command line utilities are used to shut down the Linux system.

Moreover, the “halt” command with its”-p” flag also serves the shutdown purpose. Apart from these command line methods, a GUI of the Linux system can also be used. This post has explained all the methods to shut down a Linux system.