CentOS 7 running-level switch
Commands switched from the command line level to the window level have not changed: init 5 or startx
Commands switched from the window level to the command line level have not changed: init 3
The running level of the new version is defined under/lib/systemd/system:
[Root @ localhost ~] # Ls-ltr/lib/systemd/system/runlevel *. target
Lrwxrwxrwx. 1 root 16 September 10 20:58/lib/systemd/system/default.tar get-> graphical.tar get
Lrwxrwxrwx. 1 root 13 October 13 20:58/lib/systemd/system/runlevel1.target-> rescue.tar get
Lrwxrwxrwx. 1 root 15 Aug 17 20:58/lib/systemd/system/runlevel0.target-> poweroff.tar get
Lrwxrwxrwx. 1 root 17 September 10 20:58/lib/systemd/system/runlevel4.target-> multi-user.target
Lrwxrwxrwx. 1 root 17 September 10 20:58/lib/systemd/system/runlevel3.target-> multi-user.target
Lrwxrwxrwx. 1 root 17 September 10 20:58/lib/systemd/system/runlevel2.target-> multi-user.target
Lrwxrwxrwx. 1 root 16 September 10 20:58/lib/systemd/system/runlevel5.target-> graphical.tar get
Lrwxrwxrwx. 1 root 13 October 13 20:58/lib/systemd/system/runlevel6.target-> reboot.tar get
[Root @ localhost ~] # Ln-svf/lib/systemd/system/runlevel3.target/etc/systemd/system/default.tar get
Or
[Root @ localhost ~] # Ln-svf/lib/systemd/system/multi-user.target/etc/systemd/system/default.tar get
Or
[Root @ localhost ~] # Systemctl set-default multi-user.target
[Root @ localhost ~] # Ln-svf/lib/systemd/system/runlevel5.target/etc/systemd/system/default.tar get
Or
[Root @ localhost ~] # Ln-svf/lib/systemd/system/graphical.tar get/etc/systemd/system/default.tar get
Or
[Root @ localhost ~] # Systemctl set-default graphical.tar get
1. systemd uses a more free target substitution than sysvinit. The 3rd class is replaced by multi user.tar get. Use graphical.tar get to replace the 5th class. Runlevel3.targetand runlevel5.tar get are symbolic links to multi user.targetand graphical.tar get respectively.
You can use the following command to switch to "running level 3 ":
Systemctl isolate multi-user.target or systemctl isolate runlevel3.target
Systemctl isolate graphical.tar get or systemctl isolate runlevel5.target
2. How to change the default running level?
Systemd uses links to point to the default running level. Before creating a new link, run the following command to delete the existing link: rm/etc/systemd/system/default.tar get
Default start Level 3:
Ln-sf/lib/systemd/system/multi-user.target/etc/systemd/system/default.tar get
Ln-sf/lib/systemd/system/graphical.tar get/etc/systemd/system/default.tar get
The old runlevel command can still be used in systemd. You can continue to use it, although systemd uses the 'target' concept (multiple 'targets' can be activated at the same time) to replace the runlevel of the previous system.
The equivalent systemd command is systemctl list-units-type = target.
You can set different running levels for different needs:
For example, set the command line level (init 3) method:
How to set the window level (init 5:
----------------------------- Split line -----------------------------
Modify the system running level:
You can use the following command to switch to "running level 5 ":
Default startup running level 5:
Systemd does not use the/etc/inittab file.
----------------------------- Split line -----------------------------
How to view the current running level?
The old runlevel command can still be used in systemd. You can continue to use it, although systemd uses the 'target' concept (multiple 'targets' can be activated at the same time) to replace the runlevel of the previous system.
The equivalent systemd command is systemctl list-units-type = target.