Linux, Linux shutdown command to restart, restart, log off command

A, Linux reboot command of five

  1、shutdown

  2、poweroff

  3、init

  4、reboot

  5、halt

  Second, specify five restart command

  shutdown

  reboot

  In some common linux shutdown / restart command has shutdown, halt, reboot, and init, they can achieve the purpose of restarting the system, but the inner workings of the process is different for each command, through the introduction of this article, I hope you can be more flexible application of the shutdown command.

  1.shutdown

  shutdown command to shut down the system safely. Some users will use a direct way to cut off the power supply to shut down linux, which is very dangerous. Because different linux and windows, its many processes running in the background, so the forced shutdown process may result in data loss, so that the system is in an unstable state, even in some systems may damage the hardware. And using the shutdown command before the system shutdown, the system administrator will inform all users logged on the system will be shut down. And login instructions will be frozen, that new users can not log on. Direct shut down or delay some time before shutdown is possible, may also restart. This is received by the [process] will all processes system served signal [signal]

  decided. This allows programs such as vi like have time to save the current document being edited, and image processing and e-mail [mail] [news] news programs, etc., you can leave normal.

  Its job is to perform shutdown signal [signal] to send the init process, asking it to change runlevel.

  Runlevel 0] is used to stop [halt, runlevel 6 is used to re-activate the system reboot], and runlevel 1 is to be used to put the system into state management can be performed; this is the default, assuming no -h nor -r parameter to the shutdown. To understand the shutdown or reboot [halt] [reboot] what had been done during the action, you can see these runlevels relevant in this file / etc / inittab Lane.

  shutdown parameters:

  [-T] before changing to another runlevel, tells init how long after the shutdown.

  [-R] to restart the calculator.

  [-K] does not really shutdown, only to send a warning signal to

  Each registrant [login].

  [-H] [halt after shutdown power off].

  [-N] do not init, but themselves off. Do not encourage the use of this option, and the consequences of this option is often not always what you expect to receive.

  [-C] cancel current process to cancel the shutdown process is currently being executed. So this option of course is no time parameter, but you can enter a message to explain, and this information will be sent to each user.

  [-F] fsck ignored when restarting the calculator] [reboot.

  [-F] fsck forced upon reboot calculator] [reboot.

  [-Time] [off setting time before shutdown].

  2.halt ---- easiest shutdown command

  In fact, halt is to call shutdown -h. When the halt execution, kill the application process, the implementation of sync system call, file system write operation will stop after the completion of the kernel.

  Parameter Description:

  [-N] prevent the sync system call, it is used after repairing the fsck with root partition, to prevent the old version of the kernel superblock] [superblock coverage patched superblock.

  [-W] is not a real restart or shut down, just write

  [wtmp / var / log / wtmp] record.

  [-D] [do not write wtmp record is included in the options [-n] in].

  [-F] do not call shutdown forced shutdown or restart.

  [-I] [before shutdown or restart], turn off all of the network interfaces.

  [-P] This option is the default option. It is to call poweroff shutdown.

  3.reboot

  Reboot process work almost like halt, but it is caused by a host reboot, and halt is shut down. It's almost the same parameters and halt.

  4.init

  init is the ancestor of all processes, its process number is always 1, so init will send a TERM signal to terminate all user processes ﹑ daemons. shutdown is the use of this mechanism. init run level defines eight (runlevel), init 0 to shutdown, init 1 to restart. About init can be lengthy, there is no longer narrative. Another telinit init command to change the operation level, for example, the system can telinit -iS single-user mode, and not to use the shutdown information and latency.

 

 

Linux, shutdown, restart, log off command

 

Shutdown:

  shutdown -h now # immediately shut down restart work in common

  shutdown -h +1 # 1 minute shutdown

  init 0

  halt # immediately stop the system, the need to manually power off

  halt -p #

  poweroff # immediately stop the system, and turn off the power

Restart:

  Work commonly reboot #

  Commonly used in the work shutdown -r now #

  shutdown -r +1 # one minute after the restart

  init 6

Logout:

  logout

  Work commonly used exit #

  ctrl + d # usual work

Shutdown:

  shutdown -h now # immediately shut down restart work in common

  shutdown -h +1 # 1 minute shutdown

  init 0

  halt # immediately stop the system, the need to manually power off

  halt -p #

  poweroff # immediately stop the system, and turn off the power

Restart:

  Work commonly reboot #

  Commonly used in the work shutdown -r now #

  shutdown -r +1 # one minute after the restart

  init 6

Logout:

  logout

  Work commonly used exit #

  ctrl + d # usual work

Guess you like

Origin www.cnblogs.com/h-c-g/p/11099823.html