Linux system shutdown and restart command

  

Shutdown and restart system under Linux have shutdown, halt, reboot, init, for them their internal working process is not the same.

1. Shutdown Command

Use this to safely shut down the system. However, when the system is shut down, all login users will be notified that the system will be shut down and all instructions will be frozen. That is, all new users can no longer log in. Using this command will result in immediate shutdown or restart and a delay or shutdown for a period of time. (Note: Only superusers can use this command)

Command syntax format:

shutdown [options] [time] [warning information]

Options for this command Meaning:

-k: Just issue a warning message to the user

-r: Restart the system after shutting down the system

-h: Do not restart the system after shutting down the system

-f: Quickly shut down the system, but it does not perform disk detection when the system is restarted (the system is found to enter the bios interface during the experiment, but can not do anything)

-n: Quickly shut down the system, but not After the init program closes

-c: interrupts the system shutdown (no specific experiments are found)

2, halt command

Use the halt command to call “shutdown -h” Command to execute shutdown system

command syntax format;

halt [options]

-w: is not really shutting down the system, just write “wtmp”(/var /log/wtmp)Record

-d: Do not write “wtmp”

-f: No call to “shutdown” but force close

-i: close System or reboot Before closing the system, close all network uo interfaces

-p: This option is the default option. When the system is shut down, it is called “poweroff”;

3. reboot command

4, init command

The init command uses the system's runlevel control system. It is the ancestor of all system processes, its process number is always 1, so sending “TERM” signal to init will terminate all user processes and daemons, etc., "shutdown" is to use this mechanism. Init 0 is to shut down the system, and init 1 is to reboot the system.

Copyright © Windows knowledge All Rights Reserved