Trusted answers to developer questions

What is the shutdown command in Linux?

Get Started With Data Science

Learn the fundamentals of Data Science with this free course. Future-proof your career by adding Data Science skills to your toolkit — or prepare to land a job in AI, Machine Learning, or Data Analysis.

Overview

The shutdown command is used to halt, power off, or reboot the system.

Syntax

shutdown [OPTIONS...] [TIME] [WALL...]
  • A time string may be used as the first argument, which is usually now. Before shutting down, this may be followed by a wall message delivered to all logged-in users.
  • The time string can be in the format hh:mm for hours or minutes, which specifies the shutdown time in a 24-hour clock format.
  • The time string might also be in the syntax +m, which refers to the number of minutes (m) from now.
  • now is an alias for +0, which is used to force an immediate shutdown.
  • If no time argument is given, then +1 is the default, meaning the system shuts down in 1 minute.

Note: To specify a wall message, a time argument must be specified.

The different options available are as follows:

Option Description
--help Prints help text
-H or --halt Halt the system
-P or --poweroff Power-Off the system
-r or --reboot Reboot the machine
-k Write the wall message without halt, power-off, or reboot the machine
--no-wall Do not send wall message before halt, power-off, or reboot the machine
-c Cancel a pending shutdown

Example Codes

The command below sends a wall message to all logged-in users before shutting down:

shutdown 'Hello Users! System Shutting Down'

The command below shuts down the system at 4:30 PM. The command takes the time argument in a 24-hour format:

shutdown -h 16:30

The following command restarts the system with a wall message at 4:30 PM:

shutdown -r 16:30 'Restarting System. Save your work'

RELATED TAGS

shell
shutdown
linux
Did you find this helpful?