How Linux shuts down and restarts commands

Source: Internet
Author: User

Shutdown command:

1, halt immediately shut down the machine
2, Poweroff immediately shut down the machine
3, Shutdown-h now shut down immediately (root user use)
4, shutdown-h 10 10 minutes after automatic shutdown
If you are setting the shutdown via the shutdown command, you can cancel the reboot with the SHUTDOWN-C command

Reboot command:

1, reboot
2. shutdown-r now reboot (root user)
3, Shutdown-r 10 over 10 minutes automatic restart (root user use)
4, Shutdown-r 20:35 reboot at 20:35 time (root user)
If you set the reboot through the shutdown command, you can cancel the reboot with the SHUTDOWN-C command

Shutdown parameter Description:
  
[-t] before changing to other runlevel? Tell Init how long to shut down.
  
[-R] to restart the calculator.
  
[K] does not really shut down? Just send a warning signal to each person who (login) the login.
  
[-h] turn off the power (halt) after shutting down the computer.
  
[-n] do not use init? Instead, you shut down the machine. Do not encourage the use of this option? and the consequences of this option are often not always what you expect.


  
[-c] Cancel current process cancels the currently executing shutdown program. So this option, of course, has no time parameters? But you can enter

A message to explain? And this information will be sent to each user.
  
[-f] ignores fsck while restarting Calculator (reboot).
  
[-f] Forces fsck when the calculator (reboot) is restarted.
  
[-time] To set the time before the shutdown (shutdown)


Halt----The simplest shutdown command

[-n] Prevent sync system calls? It's used after patching the root partition with fsck. To prevent the kernel from being patched with old version of Super block (superblock) overwrite

The Super block.
  
[-W] is not a real reboot or shutdown? Just write Wtmp(/var/log/wtmp) records.
  
[-d] does not write Wtmp records (already included in options [-n]).
  
[-f] forced shutdown or reboot without invoking shutdown.
  
[i] turn off all network interfaces before shutting down (or rebooting).
  
[-p] This option is the default option. is to call Poweroff when shutdown.
  
3.reboot
  
Reboot's work process is almost the same as Halt's? But does it trigger a host reboot? And halt is shutdown. Its parameters are not much different from the halt.


If you want to shut down directly after pressing, instead of using the default reboot method, you only need to edit the/etc/inittab file, which in this file will have the following

Line:

The code is as follows Copy Code
  
# Trap Ctrl-alt-delete
  
Ca::ctrlaltdel:/sbin/shutdown-t3-r now

  
You can modify the-r option to-H, with the following modified commands:

The code is as follows Copy Code
  
# Trap Ctrl-alt-delete
  
Ca::ctrlaltdel:/sbin/shutdown-t3-h now

  
When the file is modified, it is registered as root. A behavior comment line that starts with "#" that describes the script file, which the computer does not handle

The comment statement. Root users can also use the shutdown command to shut down. The Shtudown command can be executed locally or remotely. When the system is locked

When the keyboard is not available, the shutdown command can be executed by remote registration.

For example, when a host keyboard is locked, you can turn off the host by using the following methods.
  
Telnet a host name that is not available for a keyboard [registered as a normal user]
  
Su
  
[Enter password]
  
[Kill the unavailable process] or execute the command/sbin/shutdown-rn now
  
The shutdown command skipped some standard, but also time-consuming, shutdown steps, which run faster. The command appears in the system to ask

is useful (option-n causes the system to kill all processes before restarting).
  
Please note the command usage above. For security reasons, it is not possible for you to register directly as root (for example, Telnet) to a remote host. You

You can only register as a general user and then use the SU command to turn yourself into superuser.
  
The shutdown command can also cause the host to shut down after a period of time, such as by executing the following command as root:
  
$/sbin/shutdown-r 23:59
  
Will cause the host to reboot at 23:59, if shutdown is too long for you, you can use the following two commands: Reboot and halt, their work

As the name shows, it is the restart of the computer and downtime.
  
Another interesting shutdown method is to switch the system to run level 0 (downtime) or run Level 6 (reboot).
  
For example, the following command will shut down the system.
  
$ init 0
  
See file/etc/inittab for different run level definitions.
  

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.