how to

How to shutdown Linux with 15 minutes delay and message

 

How to shutdown linux from terminal? The Ubuntu shutdown shortcut can be used to shut down Ubuntu from the terminal command line.

How to shutdown Ubuntu from the terminal command line. Ubuntu shutdown command examples to use the Ubuntu shutdown command immediately or the Ubuntu shutdown command with a 15 minute delay.

shutdown command

The shutdown command shuts down the system in a safe way. All logged on users are notified that the system is going down and log on operations are blocked. The system can be turned off immediately or after a set delay.

Shutdown Command Format

malfunction [OPTIONS…] [TIME] [WALL…]
malfunction [-akrhPHfFnc] [-t sec] time [message]

note that

  • shutdown – turn off the computer.
  • restart – restart the computer.
  • stop – Stop the computer.
  • poweroff – Stop the computer.
  • restart – stop the computer.
  • wall – sends a message to all registered users for notification.

The first argument can be a time string (usually “now”). Optionally, this can be followed by a wall message that will be sent to all logged in users before going out. The time string can be in “hh:mm” format for hours/minutes indicating the time to perform the shutdown, given in 24 hour format. Alternatively, it could be the “+m” syntax, referring to the specified number of minutes m from now. “now” is an alias for “+0”, i.e. to trigger an immediate shutdown. If no time argument is given, “+1” is assumed. Note that to specify a message on the wall, you must also specify a time argument.

If a time argument is used, the /run/nologin file is created 5 minutes before the system shuts down to ensure that no further logins are allowed.

Command Options

-H, -halt : stop the car.
-P, –poweroff : power off the machine (default).
-r, –reboot : Reboot the machine.
-h : Equivalent to -poweroff if -halt is not specified.
-k : Don’t stop, shutdown, restart, just post on the wall.
–no-wall : Don’t send message to wall before shutdown, power down, reboot.
-c : Cancel a delayed shutdown. This can be used to cancel the effect of calling shutdown with a time argument other than “+0” or “now”.

Shutdown command example

How to turn off the system at a specific time

You can use the time argument with the shutdown command (in two different formats – hh:mm and relative time format +m, where m is the number of minutes since now).

The following example will schedule a system shutdown at 10:00 AM (note that the system clock is in 24-hour format):

sudo shutdown 10:00

To shutdown the system 10 minutes from the current time (now), use the following command:

sudo shutdown +10

+10 is the minutes after which you want the system to turn off.

How to shut down the system immediately

To shut down the system immediately, use +0 or its alias now with the shutdown command. See below for an example of using the command:

sudo shutdown +0

or

sudo shutdown now

How to pass a custom message to shutdown

You can broadcast your own message to let people know the system will be shut down.

$ sudo shutdown -h +5 "System will shutdown. Please save your work."

Automatically schedule an Ubuntu system shutdown

To schedule a system shutdown using the terminal, use the following command format:

shutdown -h (time in minutes)

If you want to shut down the system within the next 90 minutes, run:

shutdown -90

To cancel the shutdown command, enter the following command:

shutdown -c

restart

The shutdown command can be used to reboot the system with the r option instead of the h option. The usage is the same as before. Just replace the h option with the r option.

$ sudo shutdown -r +5 "System will shutdown in 5 minutes. Please save your work."

 

Related Articles

Back to top button