Linux shutdown and restart command detailed

Source: Internet
Author: User
Tags centos

Linux CentOS reboot Command:

The code is as follows Copy Code

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

Linux CentOS shutdown Command:

The code is as follows Copy Code

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

The above commands are not all independent of each other, Poweroff, reboot is halt link, telinit

is a link to init.

The code is as follows Copy Code

LN-SF Halt $ (ROOT)/sbin/reboot
LN-SF Halt $ (ROOT)/sbin/poweroff
LN-SF init $ (ROOT)/sbin/telinit

In the terminal input

The code is as follows Copy Code

# ls-l/sbin/poweroff
# ls-l/sbin/reboot
# ls-l/sbin/telinit

You can also see the results above.

1. Shutdown

The shutdown command is used to shut down the Linux system. It is very dangerous for some users to turn off Linux by simply breaking the power off. Because Linux and different, its background running a lot of processes, so forced shutdown may cause the process of data loss, the system is in an unstable state, and even damage hardware devices.

When the shutdown command is executed, all logged-in user systems are notified that the system will be closed and the login instruction is frozen, that is, the new user cannot log on to the system again. You can use the shutdown command to shut down the system directly, or you can delay the system at a specified time, or you can restart it. Delaying the system at a specified time allows the user time to store the files currently being processed and to close the programs that are already open.

Some of the parameters of the shutdown command are as follows:

[-T] specifies how long to shut down the system

[-R] Reboot system

[K] does not really shut down, just send a warning signal to each logged-on user

[-h] shutdown system (halt)

The essence of the shutdown command is to send a signal (signal) to the INIT program, requiring it to switch the operating level of the system (RunLevel). The operating levels of the system include:

0: Shut down the system

1: Single-user mode, if executed directly without specifying the-h or-R parameter for the shutdown command, the default will switch to this run level

2: Multi-user mode (NFS not supported)

3: Multiuser mode (support for NFS), commonly used in this kind of running level

5: Multi-user mode (GUI mode)

6: Reboot the system

2. Halt

Halt is the simplest shutdown command, which is actually invoking the Shutdown-h command. When halt executes, the application process is killed, and the kernel is stopped when the file system write operation completes.

Some of the parameters of the halt command are as follows:

[-f] forced shutdown or reboot without calling shutdown

[-i] turn off all network interfaces before shutting down or restarting

[-p] Call Poweroff when shutdown, this option is the default option

3.reboot

Reboot's work process is similar to halt, and its role is to reboot, while Halt is shutdown. Its parameters are similar to those of halt.

4.init

Init is the ancestor of all processes, and its process number is always 1. Init is used to toggle the running level of the system, and switching is done immediately. The init 0 command is used to switch the system run level immediately to 0, the shutdown, and the init 6 command to switch the system run level to 6, or reboot.

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.