40

让我们了解下Linux的运行级别

 6 years ago
source link: https://www.linuxprobe.com/linux-dyxjb.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

 

导读 Linux的运行级别有6个,而这6个运行级都有各自的功能,某个程序在一个运行级别里面运行在另一个级别就不启动,这6个运行级别可以通过如下命令查看


从上图可以看到这6个运行级别分别是:0 系统停止 1 单用户模式 2 多用户模式除开NFS功能(进入无网络服务) 3 完整多用户模式 4 未使用 5 X11图形模式 6重启
一般情况下我们处于的运行级在3或者5,那么如何切换呢,使用"init + 运行级别"回车即可直接进入,比如输入init 0电脑就会关机,输入init 6电脑就会重启


那么怎么查看在这个模式下可以使用什么功能呢,查看/etc/rc.d/init.d这个文件夹下,就是可以运行的脚本,如下图这些

那么又该如何查看每个模式下可以用的脚本文件呢,在/etc/rc.d/rcN.d文件夹中,可以分别查看各个运行级别的相对应的文件,如下图

这6种模式还有许多功能,比如说如果忘记了root密码就可以进入单用户模式,在启动后的提示符界面下输入init = /bin/sh rw就进入了模式1,把root文件挂为读写就可以跳过系统认证,直接用passwd程序来更改root用户口令了,然后再启动到正常的运行级去即可


Recommend

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK