[root@sre01 system]# systemctl get-default 
multi-user.target

[root@sre01 system]# runlevel 
N 3

[root@sre01 system]# who -r
         run-level 3  2024-10-03 20:08

runlevel 和target 之间的对应关系

运行级别        target                  指向直实文件

  • 0 runlevel0.target poweroff.target
  • 1 runlevel1.target rescue.target
  • 2 runlevel2.target multi-user.target
  • 3 runlevel3.target multi-user.target
  • 4 runlevel4.target multi-user.target
  • 5 runlevel5.target graphical.target
  • 6 runlevel6.target reboot.target

进入默认的target
systemctl default

设置默认的target
systemctl set-default multi-user.target

#切换至救援模式
systemctl rescue

#切换至紧急模式
systemctl emergency

#关机
systemctl halt
systemctl poweroff

#重启
systemctl reboot

#挂起
systemctl suspend

#休眠
systemctl hibernate

#休眠并挂起
systemctl hybrid-sleep