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.
Read More:
- Linux’s method of clearing DNS cache and refreshing DNS in shell terminal (Ubuntu, Debian)
- Error kernel restart: restart failed was reported in the background of jupyter notebook
- Several ways for Ubuntu to open command line terminal window
- There is no windows solution in dual system Ubuntu grub startup
- After canceling the startup of Ubuntu terminal, it will automatically enter the base environment of CONDA
- For the installation of anaconda3 in manjaro system, after the update (CONDA update — all), the terminal prompts an error and cannot execute CONDA related commands
- Win10 system virtual machine installation of Ubuntu system failed, prompt: UBI language failed with exit code 1
- Root password of windows 10 WSL Ubuntu system
- Ubuntu network configuration+Fixing “Failed to bring up eth0” in Ubuntu
- Kafka reported error shutdown broker because all log dirs in… Have failed
- Type error: cannot unpack non Iterable non type object appears when starting Bert server in Ubuntu system
- Error resolution by Ubuntu: aclocal-1.14 ‘is missing on your system
- Win7 and Ubuntu dual system, start error: no such partition grub rescue
- Error messages of copying files to Linux system by PSCP in Windows operating system
- Oracle database file is damaged, Error:ORA-01033 :ORACLE initialization or shutdown in progress
- Solution to prompt “system group policy forbids installation of this device” in win10 system
- CentOS 8.1 solution to error in executing #systemctl restart network.service
- Error in legal external terminal in ANSYS electronics desktop
- Installing the Ubuntu system, an error wslregisterdistribution failed with error: 0x8007019e