The shutdown process in a computing machine is quite sensitive, if the system is shut downed properly then you may observe that the system acts up at the next startup. The shutdown command in Linux allows the system to close all the applications safely/securely and then proceed with the shutdown process. This command sends a shutdown notification to all the running processes and logged in users. After that notification, neither any process can run, nor any user is permitted to login. The shutdown command can also be practiced rebooting or halt your system by using the options provided by shutdown command.
In this article, the functionality of shutdown command in Linux is described.
The implementation of the command is performed using Debian distribution of Linux as Debian is the most famous distribution of Linux and there are tens of distributions that are derived from Debian, like Ubuntu, Linux Mint, Kali Linux and so on.
Let’s start the article by discussing the working of shutdown command.
How shutdown command works in Linux
The syntax to use shutdown command is provided below.
> shutdown [OPTION] [TIME] [MESSAGE]
In the syntax, the [OPTION] extends the functionality of shutdown command. Moreover, you can also specify the shutdown time (in 24-hours format only) and [MESSAGE] refers to any message that you want to convey with the shutdown command. The upcoming section contains a brief exercise the shutdown command in Linux.
How to use shutdown command in Linux
The primary usage of shutdown command is to power off your machine. The command written below will shutdown the system and it is recommended that there is no need to pass any option or message if you just want to shut down your Linux OS.
$ sudo shutdown
As discussed earlier, the shutdown command is supported by an extensive list of options. The upcoming part of this section lists several options that can be used with the shutdown command.
– Using the -P option
The -P option of the shutdown command is practiced to shutdown the Linux system and sends a power off signal as wel to send the power off signal. You can use this option with the shutdown command in the following way.
Note : You may be thinking that a shutdown command also does the same. Yes, you are right, it is just to specify the shutdown command to stick to power off operation.
$ sudo shutdown -P
– Using -H option
The halt (power off all the CPUs) action can also be performed using -H option of shutdown command. To do so, use the following command.
$ sudo shutdown -H
– Using -r option
The shutdown command allows you to use -r option if you want to reboot your system. It can be used as shown below.
$ sudo shutdown -r
– Using -c option
What if you have specified a scheduled shutdown and you do not want the reboot/shutdown at that time? The shutdown command allows you to use -c option that cancels any scheduled operation of shutdown command. The -c option is used with shutdown command in the following way.
$ sudo shutdown -c
How to execute the shutdown command at a specific time
The shutdown command can perform any operation by specifying the time that must be in 24-Hour format. Like the command provided below reboots your system at 1700:
$ sudo shutdown -r 17:00
– specify the time in minutes
You can also specify the time in minutes to act on shutdown command. The command provided below will shutdown your machine after 20minutes(from now).
$ sudo shutdown 20
– instant shutdown
One can also use shutdown command to act instantly by specifying the now Keyword. For instance, the command shown below will shutdown the system soon after the successful execution.
$ sudo shutdown now
The shutdown command in Linux is used to power off/reboot the system, and shutdown action requires careful execution to smooth the running processes. This post describes a detailed overview of the shutdown command and its functionality. This guide also shows the usage of all the options supported by the shutdown command. These options can be used to reboot, halt, or cancel the scheduled shutdown command process. It is recommended that you try these methods to perform the shutdown smoothly.
The Best Linux Tutorials Website