欢迎光临
我们一直在努力

centos7系统运行级别简介

centos7系统运行级别简介我们知道,centos6及之前的版本中,系统运行级别通过/etc/inittab文件进行设置和控制,但在centos7中,对这个文件的设置将不会对系统运行级别产生影响,这也是centos7中变化比较大的一部分特性。

下面,我们就来介绍下系统运行级别方面的内容。

1. 运行级别对应关系

    init level           systemctl target

    0                      shutdown.target

    1                      emergency.target

    2                      rescure.target

    3                      multi-user.target

    4                      无

    5                      graphical.target

    6                      无

2. 运行级别设置

1)语法:systemctl [command] [unit.target]

2)命令及参数:

  • command部分

get-default :获取当前的target;

set-default :将默认运行级别设置为指定的target;

isolate :切换至指定的运行级别。

  • unit.target部分:为上面1节部分中给出的运行级别

3. 常用运行级别相关命令

1)systemctl

systemctl get-default:获取当前的运行级别;

systemctl set-default multi-user.target:将默认运行级别设置为mulit-user;

systemctl isolate multi-user.target:不重启系统的情况下,将运行级别切换至mulit-user;

systemctl isolate graphical.target:不重启系统的情况下,将运行级别切换至图形模式。

2) 其他

runlvel:返回结果中,第一个数为之前运行级别,后一个数为当前运行级别;

init 5:将当前运行级别切换至5(图形模式)。

   

.

赞(0)
【声明】:本博客不参与任何交易,也非中介,仅记录个人感兴趣的主机测评结果和优惠活动,内容均不作直接、间接、法定、约定的保证。访问本博客请务必遵守有关互联网的相关法律、规定与规则。一旦您访问本博客,即表示您已经知晓并接受了此声明通告。