Linux Terminal Shutdown Command: Safe Ways to Power Off
In this article
The standard Linux terminal command to shut down a computer is sudo shutdown now. To schedule a shutdown, use sudo shutdown followed by a time, such as sudo shutdown +10 to shut down in ten minutes; save your work first, because shutdown closes running sessions and applications.
What the shutdown command does
shutdown requests an orderly system shutdown. Linux alerts logged-in users when appropriate, stops services, closes processes, unmounts filesystems, and then powers off or restarts the machine. This is safer than abruptly cutting power, which can lose unsaved data or leave filesystem changes incomplete.
On many current Linux distributions, shutdown is provided through systemd’s systemctl tools, though command availability and details can vary. Administrative privileges are normally required, so prefix the command with sudo and enter your password when prompted. A root user can run it without sudo.
Common commands and examples
Choose a command that matches what you intend to do. These examples assume a typical system where shutdown supports the usual options:
sudo shutdown now— shut down immediately.sudo shutdown +10— shut down in ten minutes.sudo shutdown 23:00— schedule a shutdown for 11 p.m. local time.sudo shutdown -h now— explicitly request a halt or power-off now; on most modern systems, this powers the machine off.sudo shutdown -r now— shut down and reboot immediately.
A scheduled shutdown normally sends a warning to users with active terminal sessions. The time argument +10 means ten minutes from now; a clock time such as 23:00 is interpreted as a scheduled local time. If the specified time has already passed, behavior can depend on the implementation, so use a relative delay when that is what you mean.
For a delayed reboot, for example, run sudo shutdown -r +5. The -r option requests a restart instead of a power-off. Do not confuse it with -h, which requests a halt or power-off.
How to cancel a scheduled shutdown
If you set a future shutdown by mistake, cancel it with:
sudo shutdown -c
Cancellation applies to a shutdown that is still pending; it cannot reverse a shutdown already in progress. Depending on the system, the cancellation may also send a notice to users who were warned about the schedule. If another administrator or service has separately arranged a shutdown, cancelling your request may not cancel theirs.
Shutdown, poweroff, halt, and reboot
Linux offers several related commands, and their exact implementation can vary by distribution. On many systemd-based systems, the following commands are familiar alternatives:
sudo poweroff— request that the system power off.sudo reboot— request a restart.sudo halt— stop the operating system; whether the machine also powers off can depend on the command’s options and system.
For most desktop users, sudo shutdown now is a clear choice for an immediate orderly shutdown, while sudo shutdown -r now makes the reboot intention explicit. Avoid assuming that halt always means the same thing as powering off: historical Unix conventions and modern system integrations differ.
Using shutdown safely
Before shutting down a personal computer, save open documents and allow important file transfers or updates to finish. The command closes applications and services; it does not guarantee that every application will save its own unsaved work. On a shared machine or server, check who is logged in and whether services or scheduled jobs are relying on it.
- Use a delay when others need time to save work, and communicate the planned outage.
- Check the target before running a command over SSH or in a remote terminal; shutting down the wrong host can interrupt users or services.
- Do not use a forced power cut as a routine substitute for an orderly shutdown. Reserve physical power removal for a system that is unresponsive and cannot be stopped normally.
- On servers, follow the organization’s maintenance and access procedures. A command-line shutdown can interrupt network services just as surely as switching off a desktop.
Common errors and differences between systems
If the terminal reports shutdown: command not found, the command may be unavailable in that environment, or your shell’s PATH may not include its location. Some minimal containers and recovery environments omit normal system-management commands. Check the distribution’s documentation rather than installing or invoking an unfamiliar substitute blindly.
If you see a permission error, run the command with sudo if your account is authorized. If sudo is unavailable or your account lacks permission, contact the administrator; trying to bypass system policy is not appropriate.
Remote shells, containers, virtual machines, and desktop environments can also change what “shutdown” means in practice. A command inside a container may not be permitted to power off the physical host. On a cloud virtual machine, shutting down from inside the guest may stop or power off the instance, but billing and restart behavior are determined by the provider and instance settings. Verify the result in the relevant management interface when the machine is remote.
Frequently Asked Questions
What is the command to shut down Linux immediately?
Run sudo shutdown now. It requests an orderly shutdown immediately; you need administrative privileges.
How do I shut down Linux after a set number of minutes?
Use a plus sign and the number of minutes, such as sudo shutdown +15 for fifteen minutes. Save work and notify other users if the computer is shared.
How do I restart Linux from the terminal?
Run sudo shutdown -r now to request an immediate restart. To schedule it, replace now with a delay such as +5.
How do I cancel a Linux shutdown timer?
Run sudo shutdown -c before the scheduled shutdown begins. This does not undo a shutdown already underway.
Do I need sudo to shut down Linux?
Usually, yes, unless you are logged in as root or your system grants your account permission through another mechanism. If permission is denied, ask the system administrator.