Linux shutdown and restart commands

Source: Internet
Author: User
Common shutdown and restart commands in Linux include shutdown, halt, reboot, and init, which can be used for shutdown and restart. However, the internal working process of each command is different, next we will introduce them one by one. 1. shutdownshutdown command: Linux command

Common shutdown and restart commands in Linux include shutdown, halt, reboot, and init, which can be used for shutdown and restart. However, the internal working process of each command is different, next we will introduce them one by one.

1. shutdown

The shutdown command is used to shut down the Linux system. It is dangerous for some users to shut down Linux by directly shutting down the power supply. Because Linux runs many processes in the background, forced shutdown may lead to data loss in the process, making the system unstable and even damaging hardware devices.

When the shutdown command is executed, the system notifies all logged-on users that the system will be shut down and the login command will be frozen. that is, new users cannot log on to the system. You can use the shutdown command to directly shut down the system, delay the specified time before shutting down the system, and restart the system. If the system is shut down after a specified delay, the user can have time to store the files being processed and to close the opened programs.

Some parameters of the shutdown command are as follows:

  • [-T] specifies how long the system will be shut down
  • [-R] restart the system
  • [-K] does not actually shut down, but sends a warning signal to every logged-on user.
  • [-H] shut down the system (halt)

The job of the shutdown command is to send a signal to the init Program and require it to switch the Runlevel of the system ). The system running level includes:

  • 0: shut down the system
  • 1: in single-user mode, if the-h or-r parameter is not specified for the shutdown command, the system will switch to this running level by default.
  • 2: Multi-user mode (NFS not supported)
  • 3: Multi-user mode (supporting NFS), which is usually used
  • 5: Multi-user mode (GUI mode)
  • 6. restart the system.

2. halt

Halt is the simplest shutdown command. it actually calls the shutdown-h command. When halt is executed, the application process is killed. after the file system writes, the kernel is stopped.

Some parameters of the halt command are as follows:

  • [-F] force shutdown or restart without calling shutdown
  • [-I] disable all network interfaces before shutting down or restarting
  • [-P] poweroff is called upon shutdown. this option is the default option.

3. reboot

The reboot process is similar to that of halt. its function is to restart and halt is to shut down. 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 switch the running level of the system. The switchover is completed immediately. The init 0 command is used to immediately switch the system running level to 0, that is, shutdown. the init 6 command is used to switch the system running level to 6, that is, restart.

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.