How To Shutdown or Restart Linux with Commands

In the world of Linux, the command line interface is a powerful tool that can be used to perform a wide range of tasks. One such task is shutting down or restarting our computers directly from the terminal. This can be a useful time-saving technique that allows us to execute these tasks quickly and easily with simple commands.

In this tutorial, we will explore several ways to shut down or restart our Linux computers using command line instructions. By leveraging the power of the terminal, we can achieve these tasks with ease and efficiency. It's important to note, however, that these commands must be executed with root permissions to ensure proper functionality.

With this knowledge at our fingertips, we can streamline our workflow and take advantage of the many benefits of using Linux as our operating system. Whether we're seasoned Linux users or just starting out, the ability to control our computers from the command line is a valuable skill that can save us time and effort in our daily tasks.

Commands to Shutdown or Restart Linux

So if you're ready to take your Linux skills to the next level, join us as we explore the world of command line shutdowns and restarts. With a little bit of practice and some basic knowledge, you'll be able to master these techniques and become a more efficient and effective Linux user.

1. Shutdown

It is one of the commands best known for its simplicity and effectiveness.

The syntax to use with shutdown is as follows:

shutdown [option] [time] [message]

For example, if we want the equipment to turn off in 10 minutes we will use the following syntax:

shutdown -h 10

If we want to display a specific message indicating that the device will be turned off, we will use the following syntax:

shutdown -h 10 "The computer will be turned off, please save your work"

To see all the options of this command we will execute the following:

shutdown -help

To restart the computer we will execute the following syntax.

shutdown -r +3

2. Halt

The -h parameter allows us to stop the machine. If we execute the halt command exclusively, the computer will turned off immediately without the possibility of preventing it.

3. Poweroff

The command line interface in Linux is a powerful tool that can perform a wide range of tasks, including shutting down or restarting computers directly from the terminal. This technique can save time and effort and is a valuable skill for both seasoned and novice Linux users. However, it's important to note that executing these commands requires root permissions for proper functionality. One command that fulfills the fundamental role of turning off the machine is available, but it takes longer to write the changes before proceeding with the shutdown of the equipment. With practice and basic knowledge, mastering these techniques can make you a more efficient and effective Linux user.

With this command we can use two additional parameters:

-f (force poweroff)

-w (log the shutdown in /vat/log/wtmp)

4. Reboot

The reboot command is used to restart the computer and offers various parameters for shutting down the machine. Its syntax is simple, just type "reboot" and hit enter to initiate the restart process. 

By default, executing reboot without any parameters will turn off the system and restart it. 

reboot -p allows us to restart the system and not activate it again.

reboot - f forces the restart of the computer.

Additionally, we can use parameters such as closing the session to refresh the operating system. 

These options provide practical and useful ways to shut down or restart Linux.

It might be interesting

MOTO ZN200: Nice looks with ordinary specs

Motorola is not willing to give up and the release of its pretty slider MOTO ZN200 is an evident proof of it. So, Samsung be not proud with your wide range of sliders and see what comes.

Top 10 most powerful smartphones for May 2022

The developers of the AnTuTu benchmark have announced lists of the most powerful smartphones for May 2022. The published rankings list three main segments: flagship models, sub-flagships and mid-range mobile devices.

Install & Setup Mail Server in CentOS 7

Learn how to install and configure a mail server with this complete tutorial on your Linux machine with CentOS 7.

Google announced the introduction of a new data collection system in the browser

New technology will replace the FLoC algorithm developed in 2021