+3 votes
202 views
in Setting by (242k points)
reopened
Linux: shutdown commands to shut down and reboot the system

1 Answer

+4 votes
by (1.6m points)
edited
 
Best answer

The key shutdown commands
Shut down or restart Linux at a specified time
Other Linux shutdown commands
Linux default shutdown
Restart Linux as standard
Shut down Linux immediately
Restart Linux immediately
Shut down Linux after 20 minutes
Restart Linux after 20 minutes
Shut down Linux at 5:30 p.m.
Linux restarts at 5:30 p.m.
Shut down Linux
Set up a wall message
Cancel scheduled shutdown or restart

image

Linux: shutdown commands to shut down and reboot the system

The term shutdown defines the automatic shutdown and suspension of a computer or server. With it, the power supply to the central components of the system is interrupted in a controlled way: user programs are closed, active processes and protocols are saved to the hard disk, device drivers are removed, and device settings are saved. user. Linux operating systems can be shutdown, suspended, or rebooted using the shutdown command and its various options. Shutdown commands are entered in the Linux terminal , which is opened with the keyboard shortcut [Ctrl] + [Alt] + [T]. To return to the terminal window, press [Ctrl] + [D].

Index
  1. The key shutdown commands
    1. Linux default shutdown
    2. Restart Linux as standard
    3. Shut down Linux immediately
    4. Restart Linux immediately
  2. Shut down or restart Linux at a specified time
    1. Shut down Linux after 20 minutes
    2. Restart Linux after 20 minutes
    3. Shut down Linux at 5:30 p.m.
    4. Linux restarts at 5:30 p.m.
  3. Other Linux shutdown commands
    1. Shut down Linux
    2. Set up a wall message
    3. Cancel scheduled shutdown or restart

The key shutdown commands

The shutdown command is used to shut down or restart Linux from the terminal. More options can be added, followed by a time specification and a message. The Linux shutdown command has this syntax:

  shutdown [OPCIÓN] [TIEMPO] [MENSAJE]  

For many of the commands mentioned here, there are one or more variants that have the same result..

Linux default shutdown

 

  shutdown -h  

Linux shuts down in a minute. The -h option indicates a system shutdown or shutdown. Usually the same can be achieved by just giving the shutdown command.

  shutdown  

Restart Linux as standard

 

  shutdown -r  

Linux restarts in a minute. Option r means reboot , that is, reboot ..

Shut down Linux immediately

 

  shutdown -h 0  

Linux shuts down immediately. The shutdown command is followed here by the h option and time 0 to indicate immediacy. Another much more common command for immediate Linux shutdown is the following:

  shutdown now  

Restart Linux immediately

 

  shutdown -r 0  

Thus, Linux reboots immediately. After the shutdown command, option r and time 0 are indicated to indicate that it should be performed immediately. This is another frequently used command for immediate Linux reboot:

  shutdown -r now  

The default Linux shutdown , which occurs after one minute, is especially useful for multi-user solutions , that is, when multiple users are simultaneously accessing a Linux computer or server. The network administrator has the option of setting up a notice in the form of a wall message to inform users that the system will be shutdown or reboot shortly. If Linux is used on a single computer , the commands Shut Down Linux Immediately or Restart Linux Immediately are also usually very simple.

advice

The shutdown commands in Linux only work if you have administrator rights. On some Windows systems, this requirement can be circumvented by prefixing it with sudo : for example, in sudo shutdown now or sudo shutdown r 0.

Shut down or restart Linux at a specified time

On Linux systems you can also schedule shutdown or reboot for a specific point in time. To do this, enter the number of minutes or time after the Linux shutdown command as indicated in the following examples:

Shut down Linux after 20 minutes

 

  shutdown -h 20  

Linux shuts down 20 minutes after entering the command. The following command is more common and has the same result:

  shutdown +20  

Restart Linux after 20 minutes

 

  shutdown -r 20  

Linux restarts 20 minutes after entering the command. You can add the plus sign to this command..

  shutdown -r +20  

Shut down Linux at 5:30 p.m.

 

  shutdown -h 17:30  

On Linux, times are indicated in a 24-hour format according to the hh: mm scheme . In this example, Linux shuts down at 5:30 p.m. In this case, you can also omit the h , which explicitly indicates that the system should be shut down or suspended:

  shutdown 17:30  

Linux restarts at 5:30 p.m.

 

  shutdown -r 17:30  

Linux restarts at 5:30 p.m. In this case, the r option , which indicates reboot or reboot , cannot be removed, otherwise Linux would shut down without restarting.

Other Linux shutdown commands

In addition to the Linux shutdown commands listed, there are many other commands and options for suspending, shutting down, or restarting a Linux operating system. In general, they can also be combined with inputs to perform a timed Linux shutdown .

Note

The terms suspend and shutdown refer to different processes. If a system is suspended, all processors (CPUs) are stopped; if it is turned off, the main power supply is also interrupted. In general, shutdown refers to suspending and shutting down a system.

Shut down Linux

 

  shutdown -P  

This command specifically directs the system to shut down and the main power supply to be disconnected.

Set up a wall message

 

  shutdown 'ESCRIBIR AQUÍ EL MENSAJE DE PARED'  

The wall message o wall message is the information that appears on the screen of the operating system users. Administrators can, for example, use the wall message to warn that the system is going to shut down.

Cancel scheduled shutdown or restart

 

  shutdown -c  

This command can cancel a pending shutdown or restart. For this to happen, the process must not have started yet.

The Linux terminal allows you to shut down, suspend, and restart the operating system with simple commands. In addition to the Linux shutdown commands , you can also install a graphical interface in the form of software, such as the qshutdown program , specially designed for the Ubuntu Linux distribution.

Note

In the article Summary of the main Linux commands you will find all the necessary commands to control a Linux operating system from the terminal.


...