How to shut down your Linux system

8

Linux comes with different utilities that allow the device to be rebooted, stopped, or turned off by a system administrator. To run commands, one must be a root or group member.

The “shutdown” is employed to shut down and restart our system while the Reboot command restarts the system only. The “halt” command stops all hardware functions. It terminates the running processes and shutdown the CPU without shutting down the system.

This post illustrates how to use a terminal to shut down, restart and halt your systems.

Syntax:

The fundamental syntax of “shutdown” command is given below:

$ sudo shutdown [option] [ time]

Follow the below syntax to broadcast message before shutdown.

$ sudo shutdown [option] [ time] [ message]

Using shutdown command:

Open your terminal and type “shutdown” without any argument. The below-given command will shut down your system after 1 minute:

Use the shutdown with the “sudo” command to give the administrative privileges. Run the shown below command:

How to shut down your Linux system 1620459578 885 How to shut down your Linux system

Shutting down immediately:

Run the command to shut down the computer immediately:

How to shut down your Linux system 1620459578 753 How to shut down your Linux system

When you enter your password, the system will shut down immediately.

Alternatively, we can use “now” instead of 0:

How to shut down your Linux system 1620459578 585 How to shut down your Linux system

Use the power off parameter with shutdown command as shown below:

$ sudo shutdown –poweroff now

How to shut down your Linux system 1620459579 540 How to shut down your Linux system

Defining time to shut down the system:

You can also define a time in hours and minutes for your machine to shut down as follows.

Use the following command to shut down your machine in 5 minutes:

How to shut down your Linux system 1620459579 943 How to shut down your Linux system

Let’s assume you want to shut down your system at 7 PM; run the below-mentioned command:

How to shut down your Linux system 1620459579 560 How to shut down your Linux system

Broadcasting the message:

If multiple users are using the system, the notification will pop up on all users screens to tell them exactly that a shutdown is going to happen:

$ sudo shutdown 15 “save your work, Your system will shut down in 5 minutes.”

How to shut down your Linux system 1620459580 291 How to shut down your Linux system

Cancellation of the shutdown process:

You can cancel the scheduled shutdown process by executing the below-mentioned command:

How to shut down your Linux system 1620459580 576 How to shut down your Linux system

How to use the “reboot” command in Linux:

Reboot command restarts your system after it gets shut down.

Use the command showing below to reboot your system:

How to shut down your Linux system 1620459581 569 How to shut down your Linux system

Or

How to shut down your Linux system 1620459581 361 How to shut down your Linux system

0r

How to shut down your Linux system 1620459581 51 How to shut down your Linux system

Defining time to reboot the system:

Define time unit in hours, minutes, and seconds. The shutdown -r command will reboot the system after 10 minutes:

How to shut down your Linux system 1620459582 65 How to shut down your Linux system

It shows the system will restart after 10 minutes.

Displaying Alert message:

Like shutdown, if multiple users are running the system, a warning message will appear on each user’s screen to inform them that something is about to happen.

$ sudo shutdown –r 10 “Your system will restart after 10 minutes.”

How to shut down your Linux system 1620459582 773 How to shut down your Linux system

How to use “halt” with the “shutdown” command in Linux:

The “halt” option with the “shutdown” command shuts down the operating system but does not power the machine off. It will stop the CPU functioning:

Use the one command:

How to shut down your Linux system 1620459582 994 How to shut down your Linux system

How to shut down your Linux system 1620459583 251 How to shut down your Linux system

How to create keyboard shortcuts to shut down:

You can also shut down, reboot, and halt your system by using shortcut keys. These keys can be created in Ubuntu.

Open “Settings”, navigate to “Keyboard Shortcuts,” and on the bottom of the screen, click on the “+” symbol to create a new short cut:

How to shut down your Linux system 1620459583 269 How to shut down your Linux system

How to shut down your Linux system 1620459584 387 How to shut down your Linux system

A new window will open:

How to shut down your Linux system 1620459585 813 How to shut down your Linux system

Assign a name and enter the command. For instance, if you want to create a shortcut key to power off the system, use the command given below:

gnome-session-quit–power-off–force

Click on the “Add” button.

To enable the short cut key, click on the “Disable” button and assign a shortcut by holding the keys of your choice:

How to shut down your Linux system 1620459585 862 How to shut down your Linux system

How to shut down your Linux system 1620459585 725 How to shut down your Linux system

Once you press the keys, the following window will appear displaying your pressed buttons:

How to shut down your Linux system 1620459586 656 How to shut down your Linux system

Similarly, to reboot and halt, follow the same process described above and use the following commands:

For reboot:

gnome-session-quit–reboot–force

For halt:

gnome-session-quit-halt–force

How to shut down your Linux system 1620459586 998 How to shut down your Linux system

New shortcuts have been created. Now, let’s test the assigned shortcut keys. To reboot the system, press CTRL+ SHIFT+R, a message will appear asking to “Restart” your system, as displayed in the image below:

How to shut down your Linux system 1620459587 542 How to shut down your Linux system

Conclusion:

“Shutdown” is a command-line utility used to turn off or restart your system. It is a very good habit to shut down your system regularly. When you shut down your system, all the files and processes get closed. With the “shutdown” command, you can also set time and alert messages. Reboot and halt command is also used with the shutdown. Restarting your system is a good approach to clears the RAM and eliminates memory bugs. This post demonstrated how to shut down, reboot, and halt your Linux system using the command line or keyboard shortcuts.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More