Linux, as an open source operating system, is widely used in servers and personal computers. In the process of using the Linux system, you often encounter situations where you need to restart the system, such as software installation, system updates, etc. So, what are the restart commands in Linux? This article will introduce you to the detailed instructions and specific code examples of the Linux restart command.
The reboot command is the most basic restart command, it will restart the system immediately. When using the reboot command, you do not need to add any parameters.
Specific code examples:
reboot
The shutdown command is a command used to shut down the system. It can also be used to restart the system. If you need to restart the system, you can use the parameter -r.
Specific code examples:
reboot -r
The init command is used to initialize the system and can also be used to restart the system. Use parameter 6 to implement the function of restarting the system.
Specific code examples:
init 6
The systemctl command is a tool used to manage systemd services. It can control the start and stop of the system. and reload. Use the systemctl reboot command to reboot the system.
Specific code examples:
systemctl reboot
The telinit command is also a command used to initialize and control the system. It can be used to restart the system. Use parameter 6 to implement the function of restarting the system.
Specific code example:
telinit 6
The shutdown now command is a command used to shut down the system immediately, and can also be used to restart the system . If you need to restart the system, you can add the parameter -r.
Specific code example:
shutdown -r now
Thereboot command can also trigger an event to implement the system restart function. You can use the echo command to add the string reboot to a file in the /sys directory to trigger a system restart.
Specific code examples:
echo "reboot" > /sys/kernel/debug/kprobe_events
Summary:
In Linux, there are a variety of commands to choose from to restart the system. Use these commands to flexibly manage and maintain the system according to actual needs. Whether it is a server or a personal computer, it is very important to understand and master these restart commands. I hope this article can be helpful to everyone when using Linux systems.
The above is the detailed content of Linux restart command list. For more information, please follow other related articles on the PHP Chinese website!