The Linux command line could also be a bit arduous to study, however it’s price it. Purpose being, it is so highly effective that you are able to do nearly every thing with it you could in any other case do utilizing UI. At HowtoForge, we now have already mentioned a plethora of command line instruments (that allow you to do completely different type of operations), and right here, on this tutorial, we’ll focus on a utility which you should use to close your system down.
The utility in query in shutdown. On this tutorial, we’ll focus on the fundamentals of this device utilizing some simple to grasp examples. However earlier than we try this, it is price mentioning that each one examples right here have been examined on Ubuntu 16.04 LTS.
Linux shutdown command
The shutdown command allows you to power-off, halt, or reboot your system. Following is its syntax:
shutdown [OPTIONS…] [TIME] [WALL…]
And this is how the person web page describes it:
shutdown could also be used to halt, power-off or reboot the machine.
The primary argument could also be a time string (which is normally "now").
Optionally, this can be adopted by a wall message to be despatched to all
logged-in customers earlier than happening.
The time string could both be within the format "hh:mm" for hour/minutes
specifying the time to execute the shutdown at, laid out in 24h clock
format. Alternatively it could be within the syntax "+m" referring to the
specified variety of minutes m from now. "now" is an alias for "+0",
i.e. for triggering a right away shutdown. If no time argument is
specified, "+1" is implied.
Observe that to specify a wall message you could specify a time argument,
If the time argument is used, 5 minutes earlier than the system goes down the
/run/nologin file is created to make sure that additional logins shall not be
Following are some Q&A-styled examples that ought to offer you a good suggestion on how the shutdown utility works:
Q1. How you can use shutdown?
The fundamental utilization is straightforward – all you need to do is to run the ‘shutdown’ command.
The default habits of this device is to energy off the machine. Please word that if no time argument is specified, +1 is implied, which suggests the facility off course of shall be initiated in a minute from now. In case you need the system to energy off instantly, you should use now or +0.
In case you need to problem a wall message (to despatched to all logged-in customers earlier than happening), you are able to do that within the following approach:
shutdown ‘YOUR MESSAGE HERE’
Q2. How you can halt machine utilizing shutdown?
This may be achieved utilizing the -H possibility.
In case you are not conscious, there is a distinction between halting and powering off a system. Whereas the previous entails stopping all CPUs, the latter additionally makes positive the principle energy is disconnected.
Q3. How you can make shutdown power-off machine?
Though that is by default, you’ll be able to nonetheless use the -P choice to explicitly specify that you really want shutdown to energy off the system.
This fall. How you can reboot utilizing shutdown?
For reboot, the choice is -r.
Q5. How you can make shutdown solely write wall message, or vice-versa?
In case you simply need shutdown to shoot wall messages, with out performing a halt, power-off, or reboot, use the -k command line possibility.
Q6. How you can cancel a pending shutdown?
You should utilize shutdown to schedule a halt, energy off, or reboot. For this, all you need to do is to move the time at which you need the method to begin. For instance:
shutdown -r 18:00
Nevertheless, in case you need to cancel a scheduled shutdown, you are able to do that as effectively. This may be accomplished utilizing the -c command line possibility.
As most of you’d agree, the shutdown command does not have a steep studying curve. Most options/choices it gives are simple to grasp and use. Right here, on this tutorial, we now have mentioned the vast majority of choices. After you are accomplished training these, you’ll be able to study extra concerning the device by heading right here.