How do you usually do to shut down your Linux computer?
As you already know, apart from using the shutdown button on the GUI menu, on Linux you can also turn off your computer by using command line equally easily.
There are several commands you can use to shut down your Linux device, such as shutdown, power off, stop and reboot.
So what is the difference between these commands? Despite their general similarities, these commands have their own functions and uses.
In this article we look at what the differences are between the commands. We will see clearly what the command actually does when we run the command with the options argument which is available.
If you are a Linux server administrator who have to deal with command lines every day, it is very important for you to know what the differences are between these commands.
So you can manage and administer Linux servers more effectively.
Some commands can also perform the same function as other commands by adding options argument other additions. For more details, let’s look at the explanation and use of each of these commands.
Shutdown Command
By using the command shutdown, you can schedule a time for a system to shut down. Order shutdown can also be used to replace commands stop, power offor reboot.
Also Read: Creating Multiple Folders in One Command on Linux
To schedule a computer shutdown, you can specify the time word as argument first addition after command shutdown.
argument the usual time is ‘now’ to turn off the computer now and format ‘hh:mm’ to specify a specific time in hour/minute format.
In addition, you can set an alert message to be sent to all user which is being login in the computer before the computer is turned off.
This command is suitable if you want to turn off a computer at a certain hour, for example a server computer at an office, university or school that will definitely not be used at certain hours, for example late at night.
Instead of waiting until late at night to turn it off, you can turn off the computer by scheduling it using argument additional time when the computer will be turned off.
When argument time used on command, 5 minutes before system shutdown, file “/run/nologin” will be created to ensure that user who have not logged in, will no longer be allowed to enter the computer.
Some examples of usage of the command shutdown:
shutdown shutdown now shutdown 13:20 #Melakukan shutdown komputer pada pukul 13:20am shutdown -p now #Melakukan poweroff komputer shutdown -H now #Melakukan halt komputer shutdown -r 09:35 #Melakukan reboot komputer pada pukul 09:35am
In case you need to cancel the order shutdown that are pending or that you have scheduled, you can do this by using the following simple command:
shutdown -c
Halt command
Order stop will instruct the hardware to turn off all running CPU functions, but leave it in the on state.
You can use this command to put the system in a state where you can make repairs low level on the computer.
As a note, in some cases with the use of certain arguments, this command will also or can shut down the computer completely.
Here are some examples of using the command stop:
halt #Melakukan halt komputer halt -p #Melakukan poweroff komputer halt –reboot #Melakukan reboot komputer
Poweroff command
The poweroff command sends an ACPI signal that will instruct it to shut down the system.
Here are some examples of using the command power off:
poweroff #Melakukan poweroff komputer poweroff –halt #Melakukan halt komputer poweroff –reboot #Melakukan reboot komputer
Reboot command
Order reboot will instruct to do restart system.
Here are some examples of using the command reboot:
reboot #Melakukan reboot komputer reboot –halt #Melakukan halt komputer reboot -p #Melakukan poweroff komputer
That’s the difference from an order shutdown, stop, power off and reboot and some ways to use it.
As mentioned earlier, by understanding the differences and proper use of each of these commands, you will be able to more effectively use them.manage Linux server in the environment multi-user.