Summary of Linux system shutdown and restart commands

1 init

shutdown: init 0

reboot: init 6

 

2 reboot

reboot: reboot

 

3 shutdown

Introduction to commands

This command can safely shut down or restart the system.

command syntax

shutdown [-fFhknrc] [-t seconds] time [warning message]

Command parameters

parameter meaning
-f Do not execute fsck on reboot
-F Execute fsck on reboot
-h Shuts down the system, in a way equivalent to the halt command
-k Just send a message to all users, but don't really shut down
-n Do not call the init program to shut down, but shutdown itself. Using this parameter will speed up the shutdown, but it is not recommended to use
-r Reboot the system after shutdown
-c Cancels the previous shutdown command.
-t seconds How many seconds to delay between sending the warning message and the shutdown signal.
time Set how long before the shutdown command is executed.
Warning message Information to be sent to all logged in users.

Command example

Shutdown and restart: shutdown -r now

Shutdown immediately: shutdown -h now

Shut down after 5 minutes, and send a warning message to the user: shutdown +5 "System will shutdown after 5 minutes"

 

4 halt

Introduction to commands

When this command is executed, all applications will be terminated, then the system command sync, sync will be called to write all memory information to the hard disk through the file system, and then the kernel will be stopped.

command syntax

stop [-finp]

Command parameters

parameter meaning
-f No matter what run level the current system is in, it will force shutdown without calling shutdown.
-i Before shutting down, turn off all network interfaces.
-n When halt is executed, the system command sync is not called
-p Call poweroff when shutting down, that is, turn off the power while shutting down.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326417282&siteId=291194637