Tag Archives: Linux and embedded system structure

Restart and shutdown of Ubuntu system in the terminal

if you want to keep the current user logged in and execute the command using root:

su root

can! Enter the honey code to run, shutdown command restart command:

1, reboot

2, shutdown -r now immediately restart (used by root user)

3, shutdown-r 10 over 10 minutes automatic restart (root user)

If the restart is set by the shutdown command, the shutdown can be canceled by using the shut-down c command to restart

shutdown command:

1, halt immediately shut down

2, poweroff immediately shut down

3, shutdown-h now immediately shutdown (used by root user)

If the shutdown is set by the shutdown command, the shutdown can be cancelled by the shutdown -c command to restart

shutdown and restart systems under Linux have shutdown, halt, reboot, init, and their internal working procedures are different for them.

1, shutdown command

can be used to safely shut down the system. However, when the system is shut down, all logged in users will be notified that the system is going to be shut down, and all instructions will be frozen, that is, all new users can no longer log in. Using this instruction will result in an immediate shutdown or restart and a delayed shutdown or restart. (note: only superusers can use this command)

command syntax format:

Shutdown [option] [time] [warning message]

-k: just sends 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 do not do disk detection when restarting the system (found that the system entered the BIOS interface during the experiment, but can not do any operation)

-n: quickly shut down the system, but without an init program

-c: interrupt to shut down the system (no specific experiment found)

2, halt command

using the halt command is a call to the shut-down -h command to execute shutdown system

command syntax format;

halt [option]

-w: don’t really shut down the system, just write “WTMP” (/var/log/ WTMP) record

-d: do not write “WTMP”

-f: shutdown is not called, but

is forced to close

-i: close all uo interfaces in the network

before shutting down or restarting the system

-p: this option is the default option to call “power off”

when the system is shut down

3, reboot command

The

reboot command works similarly to the halt command, but reboot triggers a host reboot. All its parameters are similar to “HALT”.

4, init command

init command USES the system’s runlevel control system. It is the ancestor of all systems’ processes, and its process number is always 1, so signaling “TERM” to init kills all user processes, daemons, etc. Shutdown is the mechanism used. Init 0 shuts down the system and init 1 restarts the system.