Winter Sale - up to 36% OFF

Linux Shutdown Command: Power Off, Reboot, and Schedule

Linux Shutdown Command: Power Off, Reboot, and Schedule
Published on Jan 8, 2025 Updated on Jan 8, 2025

The shutdown command powers off or reboots a Linux system, depending on how it is invoked. You can power off, reboot a system, or schedule a specific time for any of these operations.

Since this is a privileged command, only the root or a sudo user can run it. In this article, we will dive into the functionality of the shutdown command, exploring its syntax and various options, so you can effectively manage your Linux system's power state.

#What is the shutdown command in Linux

The shutdown command is a command that lets you effectively shut down a Linux system. It offers a range of options for powering off your system. You can bring down your system immediately or schedule a shutdown for a specific time or after some minutes.

During shutdown, the command switches the system to runlevel 0, which triggers the system to power off. The command gracefully halts all running processes, logs out currently logged-in users, and unmounts filesystems.

#Prerequisites

To follow along, ensure you have the following:

Access to a Linux system. Any Linux system will do fine since the shutdown command is distribution-agnostic.

A sudo user configured on the system.

Deploy and scale your projects with Cherry Servers' cost-effective dedicated or virtual servers. Enjoy seamless scaling, pay-as-you-go pricing, and 24/7 expert support—all within a hassle-free cloud environment.

#Syntax

The shutdown command takes the following syntax:

shutdown [OPTIONS]

#Shut down a Linux system immediately

To shut down a Linux system immediately, use the shutdown command with the now option:

sudo shutdown now

#Schedule system shutdown

There are two distinct approaches to scheduling a system shutdown. You can schedule shutdown after m minutes. This is known as the relative format.

For example, to shut down a system after 5 minutes, run the command:

sudo shutdown +5

shutdown-linux-system-after-m-minutes

On your terminal, you will see a notification showing the expected shutdown time with your current time as a reference point.

You can also schedule shutdown using the absolute time format, where you specify the exact time the system powers off in hh:mm format. The absolute shutdown command takes the syntax:

sudo shutdown hh:mm

For example, to poweroff the system at 3:45 am, run the command:

sudo shutdown 03:45

shutdown-linux-system-at-specific-time

#Display a custom message

You can broadcast a custom message notifying all logged-in users of an impending shutdown. This is usually done out of courtesy to alert users of a scheduled downtime. It gives them time to wrap up their work gracefully before the system goes down.

To do so, run the shutdown command as shown.

sudo shutdown hh:mm “message”

Where: hh:mm: is the time in 24-hr format message: is the string of the message to be displayed

For example, to shut down the system at 1:00 am and broadcast the message "System maintenance" run the command:

sudo shutdown 01:00 "System maintenance"

shutdown-linux-system-at-a-schduled-time

#Cancel scheduled shutdown

To abort or cancel a scheduled system shutdown, pass the -c switch to the shutdown command as follows.

sudo shutdown -c

cancel-shutdown-in-a-linux-system

To make it more meaningful, you can add a message to provide a descriptive reason for the cancellation.

sudo shutdown -c "Aborting system maintenance"

shutdown-a-linux-system-at-specific-time-and-print-message

#Reboot the system

In addition to powering off a system, the' shutdown' command allows you to restart the system. For example, to carry out an immediate reboot run:

sudo shutdown -r now

You can also schedule a reboot with the -r option. The command below reboots the system at 2 am.

sudo shutdown -r 2:00

reboot-linux-system-a-specific-time-with-shutdown-command

In addition, you can schedule a reboot after +m minutes, where m is the number of minutes. For example, to reboot your system after 30 minutes, run the command:

sudo shutdown -r +30

reboot-linux-system-after-30-minutes-shutdown-command

Also read: Top 20 Linux Network Commands

#Conclusion

You have learned how to use the shutdown command to power off and reboot the system. With the knowledge acquired, you can effectively bring down a Linux system immediately or at a scheduled time. Additionally, you can reboot and schedule system restarts at your convenience. Refer to the man pages for more information.

Cloud VPS - Cheaper Each Month

Start with $9.99 and pay $0.5 less until your price reaches $6 / month.

Share this article

Related Articles

Published on Jun 7, 2021 Updated on Jun 29, 2022

AlmaLinux Review: a CentOS Clone Supported by CloudLinux

AlmaLinux is an open-source Linux distribution focused on long-term stability, that is a 1:1 binary compatible fork of Red Hat Enterprise Linux (RHEL)

Read More
Published on Sep 14, 2021 Updated on Jun 29, 2022

Debian 11 "bullseye" Review: What‘s New?

Debian 11 “bullseye” was released on 14th of August 2021. This release contains over 11294 new packages out of 59551 packages overall in its repositories.

Read More
Published on May 31, 2022 Updated on May 5, 2023

A Complete Guide to Linux Bash History

Learn how to work with Bash history to become more efficient with any modern *nix operating system.

Read More
We use cookies to ensure seamless user experience for our website. Required cookies - technical, functional and analytical - are set automatically. Please accept the use of targeted cookies to ensure the best marketing experience for your user journey. You may revoke your consent at any time through our Cookie Policy.
build: 33846e280.865