How To Shutdown Linux Using Command Line

You can shut down a Linux system using the command line by using the shutdown command. The basic syntax is as follows:

sudo shutdown [OPTIONS] [TIME] [MESSAGE]
  • OPTIONS: There are several options you can use to specify how the shutdown process should proceed. For example, you can use the -h or --halt option to halt the system after shutting down, or the -r or --reboot option to reboot the system after shutting down.
  • TIME: This is the time in minutes until the shutdown process is initiated. If you specify now, the shutdown process will start immediately.
  • MESSAGE: This is an optional message that will be broadcast to all users on the system.

Here are a few examples of how to use the shutdown command to shut down a Linux system:

  1. To shut down the system immediately:
sudo shutdown now
  1. To shut down the system in 5 minutes:
sudo shutdown +5
  1. To shut down the system in 5 minutes and display a message to all users:
sudo shutdown +5 "The system will shut down in 5 minutes. Please save your work."
  1. To reboot the system immediately:
sudo shutdown -r now

Note that the sudo command is used to run the shutdown command with administrative privileges, as shutting down the system requires elevated permissions.

Leave a Comment