On Linux systems that use systemd, running shutdown with no time waits one minute instead of acting right away. Give it a clock time that has already passed today and it does the opposite, starting the action as soon as possible.
I’ll cover choosing between power off and reboot with -P and -r, and scheduling the action with a delay or a 24-hour clock time.
What is the shutdown command in Linux?
The shutdown command requests a change to the host’s power state at a chosen time.
On systemd, it can power off the machine or restart it. It can also halt the host without cutting power.
The command handles the whole host, not one application or service. If you need to stop a process instead, use the Linux kill command.
| Action | Systemd option | Result |
|---|---|---|
| Power off | -P or –poweroff | Stop the host and turn off its power |
| Halt | -H or –halt | Stop the host without asking it to cut power |
| Reboot | -r or –reboot | Stop the current system and start it again |
Systemd treats poweroff as the default action, but other shutdown implementations can differ. The systemd shutdown manual documents the current options, while Debian’s shutdown guidance distinguishes halt from poweroff.
What do you need before using shutdown?
Shutdown changes the state of the entire machine, so your account needs administrative permission before it can request the action.
- Use a root shell or an account authorized to run commands with sudo. If sudo denies access, review how sudoers grants command permission with an administrator.
- Decide whether you mean to power off the host, reboot it, or restart one service. A service restart leaves the machine running, as explained in this Linux service control guide.
- Check which shutdown implementation your distribution provides before relying on implementation-specific options. The systemd option for displaying a pending shutdown requires systemd 250 or later.
For command syntax, open the installed manual with the man command in Linux. The upstream manual is also available from the shutdown reference page.
How to use the shutdown command
The command form is shutdown followed by optional flags, a time, and an optional message for logged-in users.
shutdown [OPTIONS...] [TIME] [WALL...]
Step 1: Choose power off or restart
Use an explicit action so the command states what should happen to the host. The poweroff flag names that result instead of relying on an implementation’s default.
sudo shutdown -P now
sudo shutdown -r now
The first command requests an immediate poweroff. The second requests an immediate reboot, which is different from restarting a single service or process.
If your task is to reboot Linux rather than power it off, see this separate guide to restarting a Linux system.
Step 2: Choose when the action runs
The TIME argument chooses when the action starts. Select an immediate request or a wait, then express that wait as a relative delay or a 24-hour clock time.
sudo shutdown -P +10
sudo shutdown -P 23:00
With systemd, now is equivalent to +0, while a missing time means a one-minute delay. A clock time earlier today can trigger the action as soon as possible, so use a relative delay when you mean to wait a set number of minutes.
Step 3: Send a message to logged-in users
Place the message after the time argument so logged-in users receive it before the scheduled poweroff.
sudo shutdown -P +10 "Maintenance begins in ten minutes. Save your work."
On systemd, /run/nologin is created before the scheduled shutdown to prevent new logins. If you only want to send a warning without powering off or rebooting, use the warning-only flag with a time and message.
sudo shutdown -k +10 "Maintenance begins in ten minutes. Save your work."
How to inspect or cancel a pending shutdown
Check a scheduled request before changing it. Use this decision order on systemd 250 or later.
- Run the show option to display a pending action and its time without changing it.
- Run the cancel option without a time argument only if you intend to remove that pending request.
sudo shutdown --show
To cancel a pending scheduled shutdown or reboot, run the cancel option without a time argument.
sudo shutdown -c
Cancellation applies to a pending request with a scheduled time. It does not reverse an immediate poweroff request after the system has begun shutting down.
What can go wrong with a shutdown request
| Symptom | Cause | What to do |
|---|---|---|
| Permission denied | The account lacks root or sudo authorization | Ask an administrator to grant the required access |
| The show option is unknown | The installed shutdown implementation does not provide it, or systemd is older than version 250 | Check the local manual before using that option |
| A clock time starts the action at once | The requested time has already passed today | Use a relative +m delay when you need to wait |
| The cancel option does not undo shutdown now | The request is immediate, not a pending future action | Do not treat cancellation as a rollback for an action already underway |
A scheduled request and an immediate request have different recovery options. If you are unsure which state the host is in, consult the systemd manual and use the inspection option only when the installed version supports it.
Inspect the pending action before scheduling another
Powering off or rebooting affects every session on the host, so check the requested action and time before submitting another one. On systemd 250 or later, the read-only inspection option shows a pending request without changing it.
sudo shutdown --show
Use the cancel option only when you intend to remove a scheduled request. An immediate shutdown is a host action, not a command you can undo after it begins.
Linux shutdown command questions
Can I cancel shutdown now in Linux?
The systemd cancel option stops a pending request with a scheduled time. It does not undo an immediate poweroff or reboot after that action begins.
Does shutdown -k power off the computer?
No. On systemd, the -k option sends the wall message without halting, powering off, or rebooting the machine.
What happens if I omit the time argument?
On systemd, omitting the time means a one-minute delay. Other shutdown implementations can differ, so check the manual installed on your distribution.
