How to Shutdown Linux Using Command Line and GUI

Command Line

1. To shut down your Linux system from the command line, open a terminal window and type the command: sudo shutdown -h now. This will immediately shut down your system.

2. To shut down your Linux system after a certain amount of time, type the command: sudo shutdown -h +[time in minutes]. For example, to shut down your system in 10 minutes, type: sudo shutdown -h +10.

GUI

1. To shut down your Linux system from the GUI, click the power button in the upper right corner of the screen.

2. Select the “Shut Down” option from the drop-down menu.

3. Confirm the shutdown by clicking the “Shut Down” button.

For a fairly new Linux user, things can be a bit overwhelming in the beginning. While the robustness and unlimited customizability options are attractive, performing basic tasks can be daunting, especially if you are unaware of the proper commands to use. For instance, you need to shut down your system, but as a new user, you are struggling to figure out the right commands to turn off your Linux computer. Though shutting down may seem like an easy task, if done incorrectly, can result in loss of data or worse – could end up corrupting your system. So, if you are a novice Linux user looking to avoid any mishaps, follow this guide to learn the safest methods to shutdown a Linux system, both through the command line and the graphical user interface (GUI).

Safely Shutdown Your Linux System (2023)

How to Shutdown Linux Using Command Line

The command line method to turn off a Linux system is preferred by seasoned users as it is fast and provides more options to play around with. This method is especially useful for shutting down Linux servers. Also, this is the most secure way as all the users currently logged in can be notified of the shutdown process so that they can save their work. There are multiple Linux commands you can use to shut down the system.

Use Shutdown Command to Turn Off Linux

The shutdown command is the most common one you can use to power off your Linux system safely. It offers a lot of flexibility since you can use the shutdown command to turn off, halt, or even reboot your PC. When you execute the shutdown command, all the current users are notified of the shutdown process. The basic syntax for shutdown command in Linux is:

sudo shutdown <options> <scheduled_time> <message>

In the above shutdown command syntax, you need to know the following things:

<scheduled_time> is used to specify the time at which the system will shutdown

<message> is used to specify the broadcast message each user will receive on their Linux shell before shutdown

<options> contains various options you can pair with the shutdown command including:

Option Description
-H Writes the final changes to data and then stops the processor from further processing tasks, but the system still stays on with minimal power consumption
-P Works the same as -H, except it cuts off the power to the system
-r Writes the final changes to the disk and then reboots the system
-k Used to send a warning message for shutdown
-c Cancels the pending shutdown

If you use the shutdown command with no parameters, the system will shutdown after one minute.

Shutdown the System at Specific a Time

As you saw above, with the <time> parameter you can set the time interval after which you want the system to shutdown. You can either use the absolute time in 24-hour format or use the relative time “+m” where m is the number of minutes from the current time. By default, the <time> parameter is set to 1 minute. The syntax to shutdown the system at a specific time is:

sudo shutdown <time>

For example, if the current system time is 15:30 and you want to shutdown the system in the next 10 minutes, then the command in the absolute time will be:

sudo shutdown 15:40

and in relative time the command will be:

sudo shutdown +10

schedule a system shutdown
Shutdown the System Immediately

If you want to shutdown the system immediately, you can either use the ‘+0‘ for the <time> parameter or its alias ‘now‘. It is very dangerous to shutdown immediately in a muti-user Linux system as it can result in loss of unsaved data or worse, completely corrupt the system. The syntax to shutdown immediately is:

sudo shutdown +0

The alternate syntax to shutdown the system immediately is:

sudo shutdown now

shutdown now
Shutdown the System With a Shutdown Message

Say you need to shutdown a Linux server for maintenance, but there may be users who are currently logged into the system who might lose their unsaved work if the server is shutdown without any prior notification. With the shutdown command, you can schedule a system shutdown and inform the users of the scheduled downtime so that they can save their work. To shutdown the system with a broadcast message, use this syntax:

sudo shutdown <time> "<message>"

For example in the above scenario, you can use the command as follows:

sudo shutdown 16:30 "System shutdown scheduled at 16:30. Please do save your work. Thank You."

shutdown using a broadcast message

Once you execute the above command, all the currently logged-in users will see this broadcast message on their wall:

Broadcast message from root@localtarget on pts/1 (Tue 2023-03-21 06:35:46 UTC):

System shutdown scheduled at 16:30. Please do save your work. Thank You.
The system is going down for poweroff at Tue 2023-03-21 06:45:46 UTC!
broadcast message viewed by the Linux user while shutting down

Shutdown Linux System Using Halt Command

There is a common misconception among many Linux users is that both halt and shutdown processes are the same as they both seem to result in the same output. However, the halt command is generally used to send the system to the halt condition, where any further data processing by the CPU is stopped while keeping the system power intact. The shutdown command in Linux, on the other hand, stops the CPU processing along with cutting off the system power. To shutdown your Linux system with halt in the command line, use the syntax below:

sudo halt -p

turning off using the halt command in Linux

Turn Off Linux System Using Poweroff Command

Both the poweroff command and the shutdown command sound very similar, but they have their differences. The poweroff command has a more “aggressive” approach and directly cuts off the power of the system immediately. If used unintentionally, the command can lead to the loss of user data. Whereas, the shutdown command has a more graceful approach, where it first writes the saved work on the disk, stops various CPU processes, and finally cuts off the power to the system. To power down the system with the poweroff command, use this syntax:

sudo poweroff

shutdown using the power off command

Shutdown Linux PC Using the init Command

The init command is used to modify the runlevels or the operating state of a process. In Linux and other Unix-like operating systems, “runlevels” are pre-defined states of the system that determine which system services are running. Each runlevel has a specific set of services and daemons that are started or stopped, and the runlevels can be modified to change the state of the system. There are 6 different types of runlevels that can be designated for different situations:

Runlevel Description
0 Shuts down the system via normal procedure.
1 set single user-mode
2 set multi-user mode without networking
3 set multi-user mode with networking
4 used by the user for their specific needs
5 used to set multi-user mode with networking and GUI
6 used to reboot the system

With the init command, you can shutdown a Linux system using the following syntax:

sudo init 0

shutdown using the init command

When you select the runlevel 0, the init command takes the more graceful approach of the shutdown command of first writing the changes made to the disk, stopping the CPU processing, and then finally cutting off the system power.

How to Shutdown Linux Using GUI Method

The GUI method to shutdown a system can only work on Linux desktop installations. This method is more common among beginners and probably the easiest of all to work with. Here we have covered how to shutdown Gnome, KDE, and Mate-based Linux systems. But, be assured, you need to follow similar steps on most other Linux Distributions.

Turn Off Gnome-Based System

1. First, head over to the top right-hand corner and click there.

Power Off option in System menu for Gnome

2. From the drop-down menu, click on the ⏻ Power Off/Logout option. Then, select the “Power Off…” option.

Power Off option in Gnome system menu dropdown

3. It will open a new dialogue box. Now click on the Power Off button to finally shutdown your system. At this stage, if you do not select any option, the system will automatically shutdown in the next 60 seconds.

Final Shutdown in Gnome

Shut Down KDE-Based System

1. Open the applications tray from the bottom or press the “Super key” on the keyboard. On most keyboards, the super key is labeled as the “Windows Icon”.

2. Select the “ Quit” option at the bottom of the tray.

Quit option in KDE

3. This will option a new dialogue box with the buttons named Suspend, Restart, and Shutdown. Click on the Shutdown button to finally shutdown the Linux system. If you do not select any option, the system will automatically shutdown in the next 60 seconds.

final shutdown button in KDE

Shut Down Mate-Based System

1. Head over to the “System” menu in the top bar and select the “Shut Down” option from the drop-down menu.

Shutdown option in system menu of MATE

2. Alternatively, click on the “⁝⁝⁝ Menu” button at the bottom or press the “Super key” on the keyboard. On most keyboards, the super key is labeled as the “Windows Icon”. Click on the ⏻ icon at the bottom.

shutdown button in menu button

3. This will open a new dialogue box with the buttons named Suspend, Restart, and Shutdown. Click on the Shutdown button to finally shutdown your system.

Shutdown dialog box in MATE

Easy Methods to Shutdown Linux System

Although the GUI method is very easy to use, it does not offer a ton of options to play with. It can only work on the Desktop Linux versions. In this article, we have shown some very easy methods for both command line and GUI users to shutdown their Linux systems. Personally, I feel the command line method works the best for all sorts of use cases and it is much faster than the GUI method. Meanwhile, check out our list of 50+ Essential Linux Commands to help you work more efficiently in the Linux command line. Do let us know in the comments if you faced any issues.

How to Shutdown Linux Using Command Line and GUI

Shutting down a Linux system is a relatively simple task, and can be done in a variety of ways. Depending on your system, you may be able to use either the command line or a graphical user interface (GUI) to shut down your Linux system. In this article, we will discuss how to shut down Linux using both the command line and GUI.

Shutting Down Linux Using the Command Line

The most common way to shut down a Linux system is to use the command line. To do this, open a terminal window and type the following command:

sudo shutdown -h now

This command will immediately shut down the system. If you want to shut down the system at a specific time, you can use the following command:

sudo shutdown -h [time]

Replace [time] with the time you want the system to shut down. For example, if you want the system to shut down at 8:00 PM, you would use the following command:

sudo shutdown -h 20:00

Shutting Down Linux Using the GUI

If your system has a graphical user interface (GUI), you can also shut down the system using the GUI. To do this, open the main menu and select the “Shutdown” option. This will bring up a dialog box that will allow you to select when you want the system to shut down. Select the time you want the system to shut down and click “OK” to confirm.

That’s all there is to it! You should now be able to shut down your Linux system using either the command line or the GUI.

Jaspreet Singh Ghuman

Jaspreet Singh Ghuman

Jassweb.com/

Passionate Professional Blogger, Freelancer, WordPress Enthusiast, Digital Marketer, Web Developer, Server Operator, Networking Expert. Empowering online presence with diverse skills.

jassweb logo

Jassweb always keeps its services up-to-date with the latest trends in the market, providing its customers all over the world with high-end and easily extensible internet, intranet, and extranet products.

Contact
San Vito Al Tagliamento 33078
Pordenone Italy
Item added to cart.
0 items - 0.00
Open chat
Scan the code
Hello 👋
Can we help you?