Blog Post
All You Should Know about Linux Shutdown Commands
Commands

All You Should Know about Linux Shutdown Commands

You can turn off your Linux system in multiple ways, but the safest one is by utilizing the shutdown command. As soon as you initiate shutting down, the system will send a message to inform other users who are logged-in, and it will prevent new logins. Let’s take a look at how you can put Linux shutdown commands to good use and maximize their benefits.

Basic Syntax

We have always believed in practical examples, but we are aware of the importance of the theory. That is why we will first learn the basic syntax of the shutdown command.

In most cases, you will follow the following form:

shutdown [OPTION] [SET TIME] [MESSAGE]

Everything is pretty self-explanatory, but let’s reveal more details about the above command:

  • [OPTION] – You can choose to turn off the system, but also to reboot it when necessary.
  • [TIME] – Specify the time when you want to initiate the command.
  • [MESSAGE] – Inform other users on why you are shutting down Linux.

Do not forget that you will have to use the “sudo” prefix to execute the command with the super user permission.

A Simple Shutdown Command

Here is the simplest Linux shutdown command to use:

sudo shutdown

The above line will order the system to initiate the shutdown in 60 seconds as that is the default time delay when executing the command.

In the meantime, you can cancel the shutdown by using the following command:

shutdown -c

a simple shutdown command

If you do not want to wait for an entire minute and want to turn off your Linux right away, here is what you should type:

sudo shutdown now

That command will initiate an immediate shutting down process.

A Delayed Shutdown

You might not be around, but you would still like the system to turn off in two hours. Here is how to do that:

sudo shutdown +30

The turning off process will start in 30 minutes from the moment when you issued the command. You can change the number “30” with any number of minutes you desire.

Turn Off the System at an Exact Time

Calculating the number of minutes when delaying the shutdown can be a hassle. How about using a particular time then?

Here is the command:

sudo shutdown XX:YY

The “XX” portion of the line is used to set the desired hour and “MM” to set the exact minute. If you want to shutdown Linux at midnight, use the following:

sudo shutdown 00:00

Keep in mind that the system clock is the one that is relevant for this command.

Inform the User about the Shutdown

If you have multiple users registered on the system, you should inform them before you turn off Linux. It is a nice thing to do as you do not want to stop them in the middle of an important task.

Here is how to initiate a shutdown command while sending other users a message:

sudo shutdown +60 "Maintenance"

If you want this command to be successful, make sure to include the time delay, too. And do not forget the quotation marks before your message. As for the content, it can be anything that comes to your mind.

Restarting the System

The “-r” option is used to initiate a system reboot:

sudo shutdown -r

You can add a custom message, as well as the desired time delay.

If you initiated a reboot by mistake, here is how to inform other users about it:

sudo shutdown -c "Reboot canceled"

Wrap Up

The Linux shutdown command is one of the easiest to use, but you should take advantage of that to turn off your system safely. We hope the article covered everything you wanted to know on the topic, but in case you need additional information, type “man shutdown” to get an overview of the utility in the command line.

Related posts

Leave a Reply

Required fields are marked *

Copyright © 2019 Blackdown.org. All rights reserved.