Shutdown Restart and Logout


Shutdown Restart and Logout

Shutdown & Restart

shutdown -h now # 立即进行关机
shutdown -h 1 # 1分钟后关机
shutdown -r now # 立刻重启计算机
halt # 关机,同上
reboot # 重启,同上
sync # 吧内存数据同步到磁盘

recommend type sync every time before shutdown

if it need permission, add sudo beforesu

Login and Logout

su - root # 切换成管理员
su - username # 切换用户
logout # 注销用户

example

current user is Tom, go to root.

Then logout at root, it will go back to Tom.

Then logout again, it will shutdown.

Notice

It will different when you operate this in Linux and in xshell.

In Linux, there is no logout for Tom.


Author: Liang Junyi
Reprint policy: All articles in this blog are used except for special statements CC BY 4.0 reprint policy. If reproduced, please indicate source Liang Junyi !
  TOC