Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

shell
shutdown
linux
communitycreator

What is the shutdown command in Linux?

abhilash

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

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
communitycreator

Grokking Modern System Design Interview for Engineers & Managers

Ace your System Design Interview and take your career to the next level. Learn to handle the design of applications like Netflix, Quora, Facebook, Uber, and many more in a 45-min interview. Learn the RESHADED framework for architecting web-scale applications by determining requirements, constraints, and assumptions before diving into a step-by-step design process.

Keep Exploring