CentOS, Linux shutdown and restart commands

Source: Internet
Author: User
Tags administrator password

Linux centos Shutdown and restart command detailed and practical

Linux CentOS Restart 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 restart at 20:35 time (root user use)

If you set the restart through the shutdown command, you can cancel the restart with the Shutdown-c command.

Linux CentOS shutdown Command:

    • 1, halt immediately shut down the machine

    • 2, Poweroff immediately shut down the machine

    • 3, Shutdown-h now immediately shut down (root user use)

    • 4, shutdown-h 10 10 minutes after the automatic shutdown

If you set the shutdown through the shutdown command, you can cancel the restart with the Shutdown-c command.

1.shutdown

Shutdown command to safely shut down the system. Some users turn off Linux using a direct power-off

This is very dangerous. Because Linux differs from Windows, there are many processes running in the background, so forcing the shutdown may

Can cause data loss to the process, leave the system in an unstable state, or even damage the hardware device in some systems.

With the shutdown command before the system shuts down, the system administrator notifies all logged-on users that the system will be closed.

And the login command is frozen, that is, the new user can no longer log in. Shut down directly or delay a certain amount of time before shutting down the machine

Is possible and may be restarted. This is the signal that the system will receive from all Processes (process) (signal)

Decision-making. This allows programs like VI to have time to store documents that are currently being edited, rather like processing mail (mail) and

The program of news (news) can leave normally and so on.

Shutdown performs its job of sending a signal (signal) to the INIT program, requiring it to change the runlevel.

Runlevel 0 is used to shut down (halt),runlevel 6 is used to reactivate the (reboot) system,

The RunLevel 1 is used to allow the system to enter the state of the management work, which is preset, assuming no-H also

There is no-r parameter to shutdown. To learn what to do during a shutdown (halt) or reboot (reboot)

Action, you can see these runlevels related information in this file/etc/inittab.

Shutdown parameter Description:

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

[-R] Restart 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 machine.

[-n] do not use init, but to shut down the machine. The use of this option is discouraged, and the consequences of this option are

Not always what you expect to get.

[-c] Cancel current process cancels the shutdown program that is currently executing. So this option is certainly not

Time parameter, but you can enter a message to interpret, and this information will be sent to each user.

[-f] ignores fsck when restarting the calculator (reboot).

[-f] forces fsck to restart the calculator (reboot).

[-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, executes the sync system call,

The kernel is stopped after the file system write operation is complete.

Parameter description:

[-n] prevents the sync system from being called, it is used after patching the root partition with fsck to prevent the kernel from using the old version of the super

Level block (superblock) overwrite the patched super block.

[-W] is not a real restart or shutdown, just write Wtmp(/var/log/wtmp) records.

[-d] does not write wtmp record (included in option [-n]).

[-f] does not invoke shutdown and forces shutdown or restart.

[-i] before shutting down (or restarting), turn off all network interfaces.

[-p] This option is the default option. is to call Poweroff when shutting down the machine.

3.reboot

Reboot works almost like halt, but it triggers a host reboot, and Halt is shut down. It

There is not much difference between the parameters and the halt.

4.init

Init is the ancestor of all processes, and its process number is always 1, so sending a term signal to init terminates all

User process ﹑ daemon and so on. Shutdown is the use of this mechanism. Init defines 8 runlevel (runlevel),

Init 0 for shutdown,init 1 restart. There is no longer a narrative about Init, which can be lengthy. In addition, there are

The Telinit command can change the runlevel of Init, such as,telinit-is, which allows the system to enter single-user mode,

And not get the information and wait time when using shutdown.

How Linux modifies the root administrator password

Log in as root (SSH operation)

Enter the passwd command to see the prompt to enter a new password

CentOS, Linux shutdown and restart commands

Related Article

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.