VMware ESXi and vSphere Cluster Management
Shut Down, Halt, Power Off, and Reboot a Linux System
Learn to safely schedule, announce, cancel, reboot, halt, and power off Linux systems with shutdown, systemctl, and related commands.
Linux should normally be stopped with an orderly shutdown rather than by removing power or resetting the machine. An orderly shutdown stops services, ends user sessions, synchronizes pending disk writes, and unmounts filesystems before the machine halts, powers off, or restarts.
Abruptly removing power can leave filesystem operations incomplete, risk filesystem corruption, and cause applications to lose data that had not yet been written. Shutdown operations usually require root privileges or authorization through sudo, polkit, or an active local console session, depending on the distribution and its policy.
What the Main Terms Mean
- Shutdown: A command used to schedule or initiate an orderly halt, power-off, reboot, or, traditionally, a transition to single-user mode.
- Reboot: An orderly stop followed by a restart of the operating system.
- Halt: Stopping operating-system and CPU activity. The machine may remain powered on.
- Power off: Stopping the operating system and requesting that the physical machine power be turned off.
- Single-user mode: A maintenance-oriented state with limited services and administrative access. It is traditionally associated with runlevel 1.
- Runlevel: A SysVinit concept describing a system operating mode, such as single-user or multi-user operation.
- Systemd target: A systemd unit representing a system state, such as
rescue.targetormulti-user.target. - Grace period: The time between scheduling a shutdown and performing the requested action.
- Broadcast message: A notification delivered to currently logged-in users about an impending system action.
The shutdown Command
The traditional command syntax is:
sudo shutdown [OPTIONS] TIME [MESSAGE]shutdown can schedule an action for a future time or begin one immediately. As the scheduled time approaches, it normally prevents new logins and broadcasts warnings to logged-in users. The exact implementation differs between distributions. Traditional SysV-style implementations require a time argument, while modern systemd environments may provide a compatibility wrapper with somewhat different defaults and accepted options.
Do not assume that an omitted action has the same meaning everywhere. Historically, shutdown without an explicit action could enter single-user mode. On a modern systemd distribution, a compatibility implementation may instead have different behavior. For predictable administration, state the intended action explicitly with -r, -H, or -P, or use the corresponding systemctl command.
Shutdown time formats
| Time value | Meaning | Example command |
|---|---|---|
now | Begin the action immediately. | sudo shutdown -P now |
+5 | Begin the action after five minutes. The general form is +MINUTES. | sudo shutdown -P +5 |
14:30 | Schedule the action for 2:30 p.m. using the system's local time and a 24-hour clock. | sudo shutdown -r 14:30 |
Before using an absolute time, check the host's clock and timezone:
dateAn absolute time is interpreted according to the system's local clock. If that time has already passed, some implementations schedule the action for the next matching time, while other behavior can vary. For a short delay, +MINUTES is often less ambiguous.
Choosing the Shutdown Outcome
| Command or option | Result | Typical use case | Important caveat |
|---|---|---|---|
shutdown -r | Orderly shutdown followed by a reboot. | Reloading the operating system after maintenance or updates. | Users and SSH sessions are disconnected during the restart. |
shutdown -H | Orderly shutdown followed by a halt. | Stopping a system while leaving the power state to the platform. | Halt does not always remove physical power. |
shutdown -P | Orderly shutdown followed by a power-off request. | Taking a machine completely offline. | Support for automatic power removal depends on the platform. |
systemctl reboot | Systemd performs an orderly reboot. | Immediate reboot on a systemd-based distribution. | Requires systemd and suitable authorization. |
systemctl halt | Systemd performs an orderly halt. | Stopping the operating system without specifically requesting power removal. | The hardware or virtual firmware may remain powered. |
systemctl poweroff | Systemd performs an orderly power-off. | Powering off a systemd-based machine. | Guest, firmware, and hypervisor support can affect the final result. |
Examples of explicit actions include:
sudo shutdown -P now
sudo shutdown -r now
sudo shutdown -H nowUse a reboot rather than a power-off when the maintenance goal is to reload the operating system and return the host to service.
Warning Logged-In Users
Place a message after the time argument. Logged-in users normally receive a broadcast warning containing the scheduled action and the supplied reason.
sudo shutdown -r +10 "Maintenance restart in 10 minutes; please save your work."A useful maintenance message states the action, schedule, reason, and expected availability time:
sudo shutdown -P +5 "Power-off in 5 minutes for hardware maintenance; service expected back at 18:00."Users connected through SSH should save their work and disconnect before the operation. A warning delivered to terminal sessions is not a complete communications plan: some users may not be actively logged in, and some environments do not deliver traditional terminal broadcasts. Use the organization's normal maintenance-notification channel as well.
Scheduling Practical Operations
Power off immediately
This performs an orderly shutdown and requests immediate power removal:
sudo shutdown -P nowRestart immediately
This performs an orderly shutdown and then reboots:
sudo shutdown -r nowSchedule a power-off in five minutes
sudo shutdown -P +5 "System maintenance in five minutes."The five-minute grace period gives users time to save work and disconnect.
Schedule a reboot at a local clock time
sudo shutdown -r 23:30Use date first when the timing matters, especially on a server whose timezone differs from your own.
Canceling a Scheduled Shutdown
Cancel a pending shutdown with -c:
sudo shutdown -c "Maintenance restart canceled; service remains available."Some implementations accept the cancellation message and broadcast it; others may only accept sudo shutdown -c. Check the local manual page if the message form is rejected.
On a shared or production system, verify what is pending before canceling it. Confirm the host identity, inspect the terminal or administrative change record that scheduled the action, and determine whether another administrator intentionally created it. A cancellation only affects a shutdown managed by that mechanism. It may not cancel a systemd timer, automation tool, hypervisor request, or cloud-provider action.
Modern systemd and Related Commands
On a systemd-based distribution, these are native power-management commands:
sudo systemctl poweroff
sudo systemctl reboot
sudo systemctl halt
sudo systemctl suspendsystemctl suspend places a supported machine into a low-power suspended state; it is not a shutdown, halt, or power-off. The commands poweroff, reboot, and halt are also commonly available. Depending on the distribution, they may route through systemd or legacy init tools.
Flags, defaults, authorization rules, and available actions vary among systemd-based distributions, SysVinit systems, containers, virtual machines, and other Unix-like operating systems. Read the local documentation when exact behavior matters:
man shutdown
man systemctlLegacy and Modern Service-State Concepts
| Legacy concept | Modern systemd equivalent or related concept | Meaning |
|---|---|---|
| runlevel 1 | rescue.target | Single-user-style maintenance state with a limited set of services. |
| single-user mode | rescue.target | Maintenance-oriented operation, normally with restricted services and administrative access. |
| rescue.target | Single-user mode or runlevel 1 | A systemd target commonly used for rescue and repair work. |
| emergency.target | No direct traditional runlevel equivalent | A more minimal recovery state, intended for urgent troubleshooting. |
These states are related concepts, not perfectly interchangeable commands. A modern systemd target graph can start and stop services in ways that do not map exactly to a numeric SysVinit runlevel.
A Safe Operational Workflow
- Identify the host. Confirm that the shell is connected to the intended local, remote, virtual, or containerized system.
- Inspect active users. Run
whoto identify logged-in users. The relatedwcommand can provide additional session and activity information where available. - Check important work. Look for active maintenance, backups, database jobs, transfers, deployments, and other operations that could be interrupted.
- Announce the outage. State the action, reason, schedule, expected duration, and expected return time.
- Prefer a scheduled grace period. Use
+MINUTESwhen possible instead of stopping immediately. - Choose the least disruptive correct outcome. Use reboot when the objective is to reload the operating system; use power-off when the machine must remain offline.
- Issue the command with authorized privileges. Use
sudoonly when your account is authorized. - Verify the result. For a reboot, confirm that the host returns and services become healthy. For a power-off, confirm through an out-of-band console, monitoring system, or physical inspection that it has stopped as expected.
Special Environments and Limitations
- Containers: A shutdown inside a container usually affects only that container and may be blocked or interpreted specially by the container runtime. It normally does not power off the host.
- Virtual machines: A guest power-off request depends on guest support and hypervisor configuration. The guest command may stop the operating system without causing the hypervisor to remove virtual or physical host power.
- Hardware and firmware: A halt may leave the machine powered on if firmware, kernel, or hardware does not support automatic power removal.
- Remote SSH sessions: Rebooting or powering off the SSH host disconnects the session. This is expected. Use an out-of-band console or remote-management interface if you need to confirm recovery.
Troubleshooting
Permission denied or authorization failure
The account may lack sudo permission, or local sudo or polkit policy may deny the operation. Run the command with sudo if authorized, use an administrator account, or request the required permission. Do not attempt to bypass local authorization policy.
The system halted but did not turn off
You may have selected halt rather than power-off, or the platform may not support automatic power removal. Use shutdown -P or systemctl poweroff when a full power-off is required, and check firmware or virtual-machine power-management support.
The shutdown happened at an unexpected time
Check the system clock and timezone with date. A 24-hour time may have been misunderstood, the clock may be wrong, or the specified time may already have passed. Prefer +MINUTES for short delays and confirm the intended schedule before announcing it.
Users did not receive or notice the warning
Users may not have been actively logged in to terminals, the environment may not support traditional broadcasts, or the notice period may have been too short. Use a longer grace period and a separate organizational notification channel.
shutdown -c does not cancel the operation
The action may already be executing, or it may have been created by a systemd timer, automation tool, hypervisor, or cloud provider. Cancel as early as possible, identify the scheduling mechanism, and use its corresponding cancellation method. Check system logs and active timers when investigating recurring actions.
The SSH connection drops
A disconnect is normal when the remote host reboots or powers off. Confirm the result through monitoring, an out-of-band console, or a remote-management interface. Do not repeatedly issue shutdown commands merely because the original SSH session disappeared.
Quick Reference
| Goal | Command |
|---|---|
| General scheduled action | sudo shutdown [OPTIONS] TIME [MESSAGE] |
| Power off immediately | sudo shutdown -P now |
| Reboot immediately | sudo shutdown -r now |
| Halt immediately | sudo shutdown -H now |
| Power off in five minutes | sudo shutdown -P +5 "System maintenance in five minutes." |
| Reboot at 14:30 local time | sudo shutdown -r 14:30 |
| Cancel a pending shutdown | sudo shutdown -c |
| List logged-in users | who |
| Check local time and timezone context | date |
| Systemd power off | sudo systemctl poweroff |
| Systemd reboot | sudo systemctl reboot |
For a broader reference, return to Linux system shutdown.