查看当前系统的运行级别
[root@apenglinux ~]# runlevel
3 5
查看系统的默认级别
[root@apenglinux ~]# systemctl get-default
graphical.target
设置系统的默认运行级别为3
[root@apenglinux ~]# systemctl set-default multi-user.target
[root@apenglinux ~]# rm -f /etc/systemd/system/default.target
[root@apenglinux ~]# ln -sf /lib/systemd/system/multi-user.target /etc/systemd/system/default.target
设置系统的默认运行级别为5
[root@apenglinux ~]# systemctl set-default graphical.target
[root@apenglinux ~]# rm -f /etc/systemd/system/default.target
[root@apenglinux ~]# ln -sf /lib/systemd/system/graphical.target /etc/systemd/system/default.target
从3级别切换到5级别
init 5
systemctl isolate graphical.target
从5级别切换到3级别
init 3
systemctl isolate multi-user.target
查看系统的运行级别
[root@apenglinux ~]# ls -l /lib/systemd/system/runlevel*target
lrwxrwxrwx. 1 root root 15 1月 18 17:03 /lib/systemd/system/runlevel0.target -> poweroff.target
lrwxrwxrwx. 1 root root 13 1月 18 17:03 /lib/systemd/system/runlevel1.target -> rescue.target
lrwxrwxrwx. 1 root root 17 1月 18 17:03 /lib/systemd/system/runlevel2.target -> multi-user.target
lrwxrwxrwx. 1 root root 17 1月 18 17:03 /lib/systemd/system/runlevel3.target -> multi-user.target
lrwxrwxrwx. 1 root root 17 1月 18 17:03 /lib/systemd/system/runlevel4.target -> multi-user.target
lrwxrwxrwx. 1 root root 16 1月 18 17:03 /lib/systemd/system/runlevel5.target -> graphical.target
lrwxrwxrwx. 1 root root 13 1月 18 17:03 /lib/systemd/system/runlevel6.target -> reboot.target