How to Use Linux Shutdown Commands

Laptop with code
Related Content

You can turn off and reboot your local or remote computer in many different ways. Powering off or rebooting your system safely and correctly is still very important, even if you’re working in the cloud. In some cases, it is also important to notify other users who may be working on a remote server. This article will show the most valuable examples of planned and instantaneous Linux shutdown or reboot operations. Extend your Linux shell skills in just one minute!

Shutdown command

The shutdown is the most commonly used Linux shutdown command we execute in the Bash or Zsh terminal in every Linux distribution. Only the user with admin permissions or root can shut down the system from the command line; the other users can’t. When you execute the shutdown command, all the logged in users get notified that the Linux system is powering off. All new logins are blocked. The root user can invoke a shutdown command and cancel a scheduled shutdown.

The basic syntax of a shutdown command syntax in Linux is:

shutdown [options] [-t seconds] time [message]

Let’s break down every argument of the above Linux command line:

  • [options] – You can use several parameters when calling this command. There are many options you can use to satisfy your needs. For example, you can use the -r argument to reboot the system and -c to cancel a pending shutdown.
  • [-t seconds] – During a shutdown, the init process changes the run level to 0 to halt the system. The -t argument will instruct the init process to wait for a number of seconds. For example, -t 10 will wait for ten seconds.
  • time – You may use the time argument to specify the exact time of the shutdown process of the system. There are two ways to do that. The first way is to use hh:mm format, where hh hours and mm are the minutes. The second way is +m, where m is the number of minutes to wait.
  • [message] – You can specify an optional message to all users to notify them about the scheduled shutdown. If specified, the shutdown command will broadcast a custom message to other logged in users.

Check the shutdown man page for additional information about the command.

Planned shutdown

It is straightforward to schedule a planned system shutdown.

To wait for 60 seconds before the shutdown:

sudo shutdown 60
Planned Linux Shutdown in X seconds command
Schedule Linux shutdown in 60 seconds (command)

Here and in all further examples, we’ll use the sudo command to elevate our privileges (become root user during the subsequent command execution).

If you’d like to wait for ten minutes before the shutdown, you may use the following command:

sudo shutdown +10
Planned Linux shutdown in minutes command
Schedule Linux shutdown in 10 minutes (command)

The terminal will notify you and other connected users that the system will shut down at a specific time.

Cancel shutdown

If you changed your mind after scheduling a shutdown, you could always cancel this operation by executing the following command:

sudo shutdown -c

Remember that this command will cancel only a pending or scheduled shutdown.

Instant system shutdown

If you’d like to stop the server immediately, you can execute the following command:

sudo shutdown now

You can’t stop this operation with a shutdown -c command.

Instant server reboot

This command is probably the most widely used in the industry. It will reboot your server immediately:

sudo shutdown -r now

Planned server reboot

To schedule a planned reboot at a specific time, execute the following command:

sudo shutdown -r 00:00
Schedule Linux reboot at specific time (command)
Schedule Linux reboot at a specific time (command)

This command will schedule a planned system reboot at midnight.

Shutdown at a specified time

You may plan not only a reboot but a complete system shutdown in the same way:

sudo shutdown 09:30
Schedule Linux shutdown at specific time (command)
Schedule Linux shutdown at a specific time (command)

Using this command, you can schedule a shutdown at any given time using a 24-hour format. Here is an example of a planned system shutdown at 9:30 AM.

Shutdown with a custom message

For example, if you’d like to be polite during the planning system reboot in a short time, you can use a custom message:

sudo shutdown -r +20 "Please, save any on-going work ASAP; the system will power off in 20 minutes."
Schedule Linux reboot at specific time with custom message (command)
Schedule a Linux reboot at a specific time with a custom message (command)

The command above will reboot your system in 20 minutes and notify connected users with a custom message.

Halt the system

There’s almost no difference between halting the system and sending it a shutdown signal. After a halt, the thin difference is that you have to push the power button to shut down the system completely.

For example, to halt the system immediately, execute the following command:

sudo shutdown -H now

Simultaneously, a regular shutdown command with -P (power off) argument will instruct the Advanced Configuration Power Interface (ACPI) to signal the power unit to turn off the system completely.

To instruct the system to power off:

sudo shutdown -P +5

Invoking the above command will shut down the system and then power it down.

Prevent any logins before the shutdown

It might be helpful to prevent users from logging into the system before rebooting. You can achieve this by using -k argument:

sudo shutdown -k

This command will send an actual shutdown message but will not shut down the system. It will block all new logins to the system.

Other commands

The shutdown command is not only a single way to stop or reboot your server. You may use other commands which do the same job.

Halt command

We already discussed the halting process. If you forget the argument of the shutdown command, you may use the halt command directly.

sudo halt

Invoking the above command will instruct the hardware to stop all CPU functions, but the system will remain powered.

Poweroff command

The poweroff command will send an ACPI signal, which instructs a system to power off immediately:

sudo poweroff

init command

The init is a unique process in Linux that brings the operating system to a specific runlevel. Every service in the Linux operating system starts on its runlevel. There are several runlevels are there in the system:

  • 0 – halt.
  • 1 – single-user mode.
  • 2 – multi-user mode.
  • 3 – multi-user mode with networking.
  • 4 – reserved for a user.
  • 5 – Start Graphical User Interface.
  • 6 – Reboot.

init command can change the runlevel to a specified one. For example, here’s another way to halt the system:

sudo init 0

This command will stop the system immediately without any user notifications.

systemctl command

systemd is a system and service manager for Linux operating systems. systemctl is a command to introspect and control the state of systemd. That means you can use systemctl as another way to shut down the system:

sudo systemctl poweroff

This command will notify all users before powering off the machine.


We hope you’ve found your personal and the most convenient way to shut down your Linux server. If you have any questions or share another helpful way of doing this, please, leave a message in the comments section below.

Of course, if you found this helpful article, please, help us spread it to the world.


We’re looking for skilled technical authors for our blog!

Table of Contents