Linux 的关机、重启和用户注销
关机
shutdown
-
shutdown -h now :立刻关机。
-
shutdown -h 1 :1 分钟后关机。(可用 shutdown -c :取消关机)
-
shutdown -r now :立刻重启。
-
halt :立刻关机。等同于 shutdown -h now。
重启
- reboot :立刻重启。等同于 shutdown -r now。
注意事项
- sync :把内存的数据同步到磁盘。
当我们关机或者重启时,都应该先执行 sync 命令,把内存数据写入磁盘,防止数据丢失
用户注销
- logout
init定义了 7 个运行级别(runlevel),比较重要的是下面4种等级:
run level 0:关机
run level 3:纯命令行模式
run level 5:含有图形界面模式
run level 6:重启
logout 注销指令在图形运行级别无效,在运行级别 3 下有效。(所以在 VM 中的 CentOS 中无法注销,在远程登陆的 Xshell 中可以使用此命令)
欢迎各位客官订阅我的 Linux 系列笔记