Restart command in Linux: 1. "shutdown -r now" command, stop the system service and then restart; 2. "init 1" restart command; 3. "reboot" command, restart immediately; 4. " poweroff" restart command; 5. "halt" restart command.
【Recommended related articles: linux tutorial】
Linux is a free-to-use and freely disseminated Unix-like operating system. It is a multi-user, multi-task, multi-thread and multi-CPU operating system based on POSIX and UNIX. It can run major UNIX software tools, applications and network protocols. It supports 32-bit and 64-bit hardware. Linux inherits the network-centric design philosophy of Unix and is a multi-user network operating system with stable performance.
Linux has five restart commands
1. shutdown
shutdown is the most commonly used and safest shutdown and restart command. Before calling fsck to check the disk, -h and -r are the most commonly used parameters:
-h:停止系统服务并关机 -r: 停止系统服务后重启
Example:
shutdown -h now --立即关机 shutdown -h 10:53 --到10:53关机,如果该时间小于当前时间,则到隔天 shutdown -h +10 --10分钟后自动关机 shutdown -r now --立即重启 shutdown -r +30 'The System Will Reboot in 30 Mins' --30分钟后重启并并发送通知给其它在线用户
2, poweroff
poweroff means immediate shutdown, the effect is the same It is not recommended to use shutdown -h now in multi-user mode (Run Level 3).
3. init
语法:init(选项)(参数) -b:不执行相关脚本而直接进入单用户模式; -s:切换到单用户模式。 0 停机(千万不能把initdefault 设置为0) 1 单用户模式 2 多用户,没有 NFS(和级别3相似,会停止部分服务) 3 完全多用户模式 4 没有用到 5 x11(Xwindow) 6 重新启动(千万不要把initdefault 设置为6)
init is the ancestor of all processes, and its process number is always 1, so sending the TERM signal to init will terminate all user processes, daemon processes, etc. shutdown uses this mechanism. init defines 8 runlevels, init 0 is shutdown, and init 1 is restart.
4. Reboot
Reboot means to restart immediately. The effect is equivalent to shutdown -r now
5. Halt
Ignore the current system status and proceed. Hardware shutdown is generally not recommended.
This article is an introduction to the Linux restart command. I hope it will be helpful to friends in need!
The above is the detailed content of What is the Linux reboot command?. For more information, please follow other related articles on the PHP Chinese website!