Linux Shutdown and Restart Commands  What are they? + List ▷ 2021

If there is something that characterizes the Linux operating system are the commandsThis is how each of the users of this system can perform different types of activities through them, such as the shutdown of the equipment when it is finished using or its reboot, either to finish the installation of an application, refresh the processes or because an error has been generated there.

Without a doubt to be able to carry out these functions through the lines of codes it will permit you save time and above all to carry out these tasks in a simpler and faster way. Currently the term shutdown refers to computer OS auto shutdown and sleep, so your mission is interrupt power supply to core components.

Therefore, if you are starting to take your first steps and you still do not know what Linux commands use to shut down or restart the computer, so here we are going to teach you a little more about what are they, what are they for and what are all the commands you can use for it. In this case, simply follow in detail everything that we are going to teach you next in the post.

What are Linux shutdown and restart commands and what are they for?

What are Linux shutdown and restart commands and what are they for?

Currently all operating systems allow shutdown or reboot the system through different methods, in this case the OS of Linux is not the exception, it offers different command lines that will allow its users to perform the shutdown or restart process in an easy way. Carrying out this process is very important, since they allow close all functions and processes executed in a safe way, thus offering good performance the next time the equipment is switched on again.

As mentioned earlier in the post, the term “Shutdown” refers to what is the shutdown and suspension of the equipment, its main function is to cut off the power supply to the central components of the system in a controlled way, this allows to carry out the closure of active protocols, open processes and programs that the user has used. During this process also device drivers are removed and store user settings.

Therefore, Linux operating systems they can shut down, restart or suspend the computer using the command “Shutdown” and its different options, to open this line of code you must press the keyboard shortcut “Ctrl + Alt + T” and to return to the terminal window you must press the shortcut “Ctrl + D”.

Regarding the syntax of the command, it has the following:

  • Shutdown [OPTIONS] [TIME] [WALL]

In this case in the argument of [OPTIONS] can be a string of characters that are followed by the time details [TIME], as an optional argument you can write a message in [WALL] to notify registered users that the system will shut down. In the case of the time string it has a format of hh: mm (Hours / minutes), the 24 hour time format. This will specify the moment when the will execute the shutdown command.

In the case you want schedule machine shutdown through minutes, then you can do it using + m and there set the number of minutes you want for this action to take place. It is also possible to use “Now” in the syntax, which is the alias for +0 minutes, this will allow the shutdown to be triggered immediately and if you don’t specify anything in the argument of [TIME], then Linux by default will apply +1 before shutting down the system.

The time arguments are very important so that you can specify a message to the rest of the users where you indicate that the system will close. In the case of archivo/run/nologin going to close 5 minutes before shutdown, this to ensure that no more logins, but note that this will happen only if a time string and it has not executed shutdown immediately.

What are the benefits of using the console to shut down or restart Linux?

Without a doubt being able to use the console to shutdown or reboot Linux system It will offer you certain advantages when you have to carry out these actions. Especially since they are practically mandatory to use every time you the equipment is turned on, Either for shut down the system in general or to restart it due to a malfunction or any other activity that requires it.

In accordance with this, here we show you the main benefits that this brings you:

  • Allows this process to be much faster and easier to do, so users can save time.
  • Send a notification to all logged in users about the shutdown time and the login will be disabled.
  • You can choose if you want the system to turn off immediately or that after a certain period of time.
  • Any process indicated you will be notified by a SIGTERM signal, This allows time for applications, as well as any editor or file to save all changes and close, preventing the information that has undergone changes from being lost.
  • Allows all services to be stopped cleanly at the time of execute shutdown.
  • There are different methods to bring about shutting down or restarting the linux system.

Know the best commands to shut down or restart Linux from the console

Know the best commands to shut down or restart Linux from the console

As has been mentioned throughout the post, currently you can find different commands that will allow you to shutdown and restart Linux from the console, This is how here we are going to teach you each one of them so that you can start applying it according to your needs.

To do this, follow the list that we will show you below:

Command to shut down a Linux machine or server

In order to turn off the linux server Through a command it is very easy, for this you must indicate that you want to turn off at the same time as indicated.

To do this you must use “now” in this case it would be as follows:

It is also possible to highlight that on many occasions this does not work, this is mainly due to Linux distribution that is installed at that time.

However, if the line mentioned above does not work, then as an alternative to achieve the same result you can apply the following:

Command to reboot Linux system

In the case that what you want is to restart the Linux server, the procedure is very easy, for this you must apply the following command line:

It can also be used if you want the following to be done at the same time:

Schedule a Linux server shutdown

It is also possible to reach schedule shutdown when any work or homework and it is known more or less how long will it take, in this way at the beginning you can program that the equipment is turned off at the time, two hours or the time you want to give it.

For this type of actions, being able to program this is very useful, for example, if you want to turn off after 15 minutes, then you will need to write the following lines:

#shutdown –r +15

Broadcast message from me my-pc

(/dev/pts/1) at 18:13 …

The system is going down for reboot in 10 minutes!

Schedule Linux Server Reboot

In case you want Restart the system, then the same thing will also happen, in these cases it is about schedule computer restart so that it originates at a specific time.

For the computer to restart at 3 in the morning, keep in mind that the time format is 24 hours:

#sudo shutdown –r 03:00

Broadcast message from me my-pc

(/dev/pts/1) at 18:00 …

The system is going down for reboot in 480 minutes!

Command to shut down a remote Linux machine

In the event that Linux machine is remote, then you can turn it off at the same time or using one of the variants that we have taught you previously.

Or in this case in the following way indicating the IP of the remote Linux machine:

  • $ ssh root@ /sbin/shutdown -r now

Command to reboot a remote Linux machine

If the Linux computer is remote, then it is possible to restart it as follows, for this you must indicate the IP of the machine:

  • $ ssh /sbin/reboot

If you have any questions, leave them in the comments, we will answer you as soon as possible, and it will surely be of great help to more members of the community. Thanks! 😉

Nely zambrano

Author: Nely Zambrano

I have extensive experience in the technological field, my specialties are graphic design, social networks and Digital Marketing. Windows and Android are my specialty.

You may be interested:

Rate this post

Leave a Comment