Home > Package & System Management > shutdown

shutdown: Safely Shutting Down Your System

The `shutdown` command is used to safely shut down or reboot the system. It notifies all users of the shutdown at a specified time and gracefully terminates all processes to prevent data loss.

Overview

Simply cutting power when shutting down a system can lead to data corruption or file system errors. `shutdown` is essential in server environments because it safely terminates all running processes, logs events, and then shuts down the system.

Key Features

Key features of the `shutdown` command include:

  • Ability to schedule system shutdown/reboot at a specified time
  • Sends shutdown notification messages to all logged-in users
  • Synchronizes file systems and gracefully terminates processes
  • Supports both immediate and scheduled shutdowns

Shutdown Types

The `shutdown` command supports various shutdown methods.

  • Halt: Shuts down the system but does not power it off, leaving it in a suspended state.
  • Poweroff: Completely shuts down the system and turns off the power. In most cases, it behaves identically to the 'shutdown -h' option.
  • Reboot: Shuts down the system and then immediately restarts it.

Key Options

Commonly used `shutdown` command options are grouped by purpose.

1) Shutdown/Reboot

2) Time and Message

3) Help

Generated command:

Try combining the commands.

Description:

`shutdown` Executes the command.

Combine the above options to virtually execute commands with AI.

Usage Examples

Learn the functionalities of the `shutdown` command through various usage examples.

Immediate System Shutdown

sudo shutdown -h now

Shuts down the system immediately without delay and powers it off. Uses the 'now' keyword.

Reboot System in 10 Minutes

sudo shutdown -r +10

Reboots the system 10 minutes from the current time. Uses the '-r' option for reboot and '+10' for 10 minutes later.

Reboot at Specific Time with Message

sudo shutdown -r 22:30 "Regular system maintenance will be performed."

Reboots the system today at 22:30, sending a maintenance message to all logged-in users.

Cancel Scheduled Shutdown

sudo shutdown -c

Cancels a pending `shutdown` command. A notification is sent to all users at the time of cancellation.

Installation

The `shutdown` command is typically included by default in most Linux distributions. No separate installation is required.

Tips & Cautions

Here are some points to keep in mind when using the `shutdown` command.

Tips

  • The `shutdown` command requires root privileges, so it should be used with 'sudo'.
  • `shutdown -h now` and `poweroff` behave almost identically, but `shutdown` is safer as it allows time for processes to terminate gracefully.
  • If the `shutdown` command does not work, you can use 'init 0' (for shutdown) or 'init 6' (for reboot). However, these commands may not be as safe as `shutdown`.
  • To cancel a scheduled shutdown, you must use 'shutdown -c'.

Related commands

These are commands that are functionally similar or are commonly used together.


Same category commands