There are shutdown, halt, reboot, and init under Linux to shut down and restart the system. For them, their internal working process is different.

Another year passed,In 2010, maybe Microsoft grabbed the halo of Linux last year.It's not easy.In fact, Linux is getting hotter,Many computer users have linux installed. For those Linux beginners, this article introduces the Linux shutdown and restart commands in detail for you.For you to play a certain role in learning the Linux shutdown command.

1.shutdown command

Use it to safely shut down the system,However, when shutting down the system,Will notify all logged in users that the system is about to shut down,And all instructions will be frozen,That is, all new users can no longer log in,Using this command will cause immediate shutdown or restart and a delay of shutdown or restart.(Note:this command is only available to superusers)

Command syntax format:

shutdown [options] [time] [warning message]

The meaning of the options in this command:

-k:just issue a warning message to the user

-r:restart system after shutdown

-h:do not restart the system after shutdown

-f:quickly shut down the system,But the disk test is not performed when the system is restarted (the system is entered into the bios interface during the experiment, but no operation can be performed)

-n:quickly shut down the system,But not closed by init program

-c:Interrupt to shut down the system (no specific how to experiment)

2.halt command

Using the halt command is to call the "shutdown -h" command to perform a system shutdown

Command syntax format;

halt [options]

-w:not really shut down the system,Just write "wtmp" (/var/log/wtmp) records

-d:do not write "wtmp"

-f:force shutdown without calling "shutdown"

-i:Before shutting down the system or restarting the system,Close all network uo interfaces

-p:This option is the default option,"Power off" is called when the system is shut down

3.Reboot command

The reboot command works similarly to the halt command.But reboot is causing the host to restart.All its parameters are similar to "halt".

4, init command

The above is all the narratives we can share for you to easily grasp the Linux shutdown and restart commands.Hope you like it.

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 a "term" signal to init will terminate all user processes, daemons, etc."Shutdown" uses this mechanism.init 0 is to shut down the system,init 1 is to restart the system.

  • Previous In-depth analysis of the related use of enumerated types in Swift programming
  • Next php jump to the corresponding web page according to the user language