linux中关机重启命令

andylanzhiyong 2020-02-19

shutdown

解释

关机重启命令

语法

shutdown [选项] 时间
    -c 取消前一个关机命令
    -h 关机
    -r 重启

示例

# 现在立刻关机
shutdown -h now

# 定时关机
shutdown -h 20:30

# 现在立刻重启
shutdown -r now

其他关机命令

halt
poweroff
init 0

其他重启命令

reboot
init 6

系统运行级别

关机
  单用户(启动最小的服务,用来做修复,类似windows安全模式)
  不完全多用户,不含NFS(network file system)服务
  完全多用户
  未分配
  图形界面
  重启

查看运行级别的方法

cat /etc/inittab
上面的centos7 已取消运行级别,使用targets取代

[1hh0kkwoiz ~]# cat /etc/inittab
# inittab is no longer used when using systemd.
#
# ADDING CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM.
#
# Ctrl-Alt-Delete is handled by /usr/lib/systemd/system/ctrl-alt-del.target
#
# systemd uses 'targets' instead of runlevels. By default, there are two main targets:
#
# multi-user.target: analogous to runlevel 3
# graphical.target: analogous to runlevel 5
#
# To view current default target, run:
# systemctl get-default
#
# To set a default target, run:
# systemctl set-default TARGET.target



# 查看运行级别
systemctl get-default

[ ~]# systemctl get-default
multi-user.target

# multi-user.target: analogous to runlevel 3
# graphical.target: analogous to runlevel 5

logout

解释

退出登录

相关推荐

LinuxNotes / 0评论 2010-07-13