Basic use
Power off now:
sudo shutdown -h now
-h means halt (stop) and, on most systems, power off.
Schedule a shutdown
In 10 minutes:
sudo shutdown -h +10

At a specific time (24-hour clock):
sudo shutdown -h 23:30
Send a message
The message goes to all logged-in users:
sudo shutdown -h +10 "System will shut down in 10 minutes. Please save your work."
Cancel a shutdown
sudo shutdown -c

Restart
sudo shutdown -r now
Restart in 5 minutes:
sudo shutdown -r +5
Options
-hhalt the system.-Ppower off after halting.-rreboot.-ccancel a scheduled shutdown.-konly send the warning, do not shut down.--no-walldo not send the wall message.
The older options -i, -f and -t come from other systems and do not exist in the shutdown of current systemd-based Linux. To power off at once without a delay you can also run systemctl poweroff, and to restart systemctl reboot.
Use cases
- Planned maintenance. Schedule a shutdown for a quiet hour.
- Emergency. Stop the machine now to prevent damage.
- Restart after updates, for example a kernel update.
Warning: On a remote server a shutdown turns the machine off, and you may not be able to turn it back on. Use
-r (reboot) when you are connected through SSH, unless you have console or panel access.Quick recap
shutdown -h nowpowers off,shutdown -r nowrestarts.shutdown -ccancels a scheduled one.