System and processes

The shutdown command

Powers off or reboots the machine in order, warns users and can be scheduled.

Syntax

sudo shutdown [-h|-r] now | shutdown -cTry it in the terminal →

Most useful options

-H, --haltHalts the system without cutting power, according to the systemd manual. To power it off fully, use -P
-P, --poweroffPowers the machine off. It is the default action if none is given
-r, --rebootReboots the machine instead of powering it off
-hSame as --poweroff, but does not override the action if halt was requested with -H
-kDoes not power off or reboot: it only sends the warning to users
--no-wallDoes not send the warning to users before the action
-cCancels a scheduled shutdown or reboot with a time other than now
--showShows whether a shutdown is pending and when. Available from systemd 250

Copy-ready examples

$ sudo shutdown -ccancels a pending shutdown. It is the safe example to try the command.
$ sudo shutdown -r +10reboots in ten minutes and warns users. Warning: it affects every session on the machine.
$ sudo shutdown -h 23:30powers off at 23:30. If that time has already passed today, it is scheduled for tomorrow. Warning: it cuts off every user.
$ sudo shutdown -h nowpowers off now, without waiting. Warning: unsaved work is lost; run it only if you are sure.
$ shutdown --showshows whether a shutdown is scheduled and when, on systemd 250 or later.

You can try them in the browser terminal: it does not touch your computer.

Typical mistakes

  • Without a time or +minutes, shutdown schedules the action one minute ahead, not right now.
  • A time that has already passed, such as 08:00 when it is 10:00, is not an error: the shutdown is scheduled for tomorrow.
  • With a scheduled time, about five minutes before, /run/nologin is created and no new logins are allowed.
  • It requires administrator rights. On a remote server, powering off without warning can cut your own SSH connection.

Differences from similar commands

  • reboot: restarts at once and takes no time. shutdown can schedule the action and warn users.
  • poweroff: powers off at once; it does not schedule or take a time.
  • systemctl: has the poweroff, reboot and halt verbs, with the same function and extra options, such as --when.

FAQ

How do I cancel a shutdown?

With shutdown -c before the scheduled time arrives.

What is the warning to users?

The message shutdown sends with wall to open sessions. --no-wall stops it, and -k sends it without powering off anything.

How do I see whether a shutdown is scheduled?

With shutdown --show, on systemd 250 or later. Older versions do not have that option.

More System and processes commands

Learn to actually use it

The basic Linux course takes you from zero to console fluency with 24 self-grading lessons.

Start the free course