LINUX Shutdown and restart commands detailed __linux

Source: Internet
Author: User
LINUX centos Shutdown and restart command detailed

Reprint: https://www.cnblogs.com/itlive/p/4097891.html

Linux CentOS reboot command: 1, reboot 2, Shutdown-r now reboot (root user) 3, shutdown-r 10 10 minutes automatic restart (root user) 4, SHUTD Own-r 20:35 reboot at 20:35 hours (root user used)

If you set the reboot through the shutdown command, you can cancel the reboot with the SHUTDOWN-C command

Linux centos Shutdown Command: 1, Halt immediately shut down 2, Poweroff immediately shut down the Machine 3, Shutdown-h now immediately shut down (root user use) 4, shutdown-h 10 10 minutes after automatic shutdown Machine

If you are setting the shutdown via the shutdown command, you can cancel the reboot with the SHUTDOWN-C command

1.shutdown

The shutdown command shuts down the system securely. It is very dangerous for some users to turn off Linux by simply breaking the power off. Because Linux differs from windows in that it runs many processes in the background, forcing a shutdown can cause data loss in the process, leaving the system in an unstable state, or even damaging hardware devices in some systems. Using the shutdown command before the system shuts down, the system administrator notifies all logged-in users that the system will be closed. And the login command is frozen, that is, the new user can no longer log in. It is possible to shut down the machine directly or delay it for a certain time, and it may reboot. This is determined by the signal (signal) that all process (process) will receive the system delivery. This lets programs like VI have time to store documents that are currently being edited, and programs like Mail (mail) and news (news) can leave and so on.

Shutdown performs its work by sending signals (signal) to the INIT program, requiring it to change runlevel.

RunLevel 0 is used to stop (halt),runlevel 6 is used to reactivate the (reboot) system, while RunLevel 1 is used to allow the system to enter the state that management can perform; This is a preset, assuming no-H and no-R parameter to shutdown. To find out what you did during the downtime (halt) or reboot (reboot), you can see the runlevels related information in this file/etc/inittab.

  Shutdown parameter Description:

[-T] tell Init how long to shut down before changing to another runlevel.

[-R] to restart the calculator.

[K] does not really shut down, just send a warning signal to each login (login).

[-h] turn off the power (halt) after shutting down the computer.

[-n] do not need to init, but to shut down the machine. Use of this option is discouraged, 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 certainly does not have a time parameter, but you can enter a message to interpret, 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] Sets the time before the shutdown (shutdown).

  2.halt--The simplest shutdown command

In fact, halt is called shutdown-h. Halt executes, kills the application process, performs the sync system call, and stops the kernel after the file system write operation completes.

Parameter description:

[-n] Prevents sync system calls, which are used after patching the root partition with fsck to prevent the kernel from using the old version of the super

Block (superblock) overwrite the patched 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, but it triggers a host reboot, and Halt is shutdown. Its parameters are not much different from the halt.

4.init

Init is the ancestor of all processes, and its process number is always 1, so sending term signals to init terminates all user processes ﹑ daemons, and so on. Shutdown is the use of this mechanism. Init defines 8 run levels (runlevel), Init 0 for shutdown,init 1 for reboot. There is no longer a narrative about init that can be lengthy. There are also telinit commands that can change the running level of init, such as,telinit-is, which allows the system to enter Single-user mode, and does not have the information and latency to use shutdown.


How Linux modifies the root admin password

Log in as root (SSH operation), enter the passwd command to see prompts to enter a new password, when the password is not seen characters.

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.