In this tutorial, we will show you how to shutdown or reboot Linux using the Command-Line. For those of you who didn’t know, Most of the popular Operating systems out there allow you to shut down your PC, laptop, or server with different methods. Linux operating systems also have ways for a user to safely shut down, reboot, hibernate or suspend your Linux system.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘
sudo‘ to the commands to get root privileges. I will show you through the step-by-step learned shutdown and reboot commands on Linux machines.
Shutdown or Reboot Linux Using Command Line
Step 1. Linux shutdown command.
The shutdown command in the Linux system lets you power off, reboot, and halt your system. Below is the command syntax that is being used to shut down and restart the machine.
- Shutdown command syntax:
shutdown [OPTIONS] [TIME] [MESSAGE]
[options]define whether you want to halt, power off, or reboot the machine.
[time]specifies when you want the shutdown to perform.
[message]adds a message that announces the shutdown.
The following example will schedule system shutdown at 12 A.M:
sudo shutdown 12:00
The following example will schedule system
shutdown in 15 minutes from now:
sudo shutdown +15
To view all parameters when shutting down the Linux system, use the following command:
sudo shutdown --help
Step 2. Linux reboot command.
The next command is the reboot command. Reboot command is used restart or reboot the system. In a Linux system administration, there comes a need to restart the server after the completion of some network and other major updates.
- Reboot command syntax:
–help: This option prints a short help text and exit.
–halt: This option halt the machine, regardless of which one of the three commands is invoked.
-p, –poweroff : This option will going to power-off the machine, regardless of which one of the three commands is being invoked.
–reboot: This option reboot the machine, regardless of which one of the three commands is invoked.
–force: This option force immediate halt, power-off, or reboot. When it is specified once, this results in the immediate but clean shutdown by the system manager. When it is specified twice, this results in immediate shutdown without contacting the system manager. See the description of the option –force in systemctl(1) for more details.
–wtmp-only: This option only writes wtmpshutdown entry, it do not actually halt, power-off, reboot.
For example, running the following command to restart your system:
Congratulations! You have successfully learned the shutdown and reboot commands on Linux systems. For additional help or useful information, we recommend you check the official Linux website.