介绍:inittab为linux初始化文件系统时init初始化程序用到的配置文件
基本格式:
0 |
id:runlevels:action:process |
运行级别:
0 1 2 3 4 5 6 7 |
# Default runlevel. The runlevels used are: # 0 - halt (Do NOT set initdefault to this) #关机 # 1 - Single user mode #单用户模式 # 2 - Multiuser, without NFS (The same as 3, if you do not have networking) #不具备NFS(网络文件系统)的多用户模式 # 3 - Full multiuser mode #具有网络功能的多用户字符界面 # 4 - unused #未定义 # 5 - X11 #图形界面 # 6 - reboot (Do NOT set initdefault to this) #重新启动 |
Centos 6.x
0 1 2 3 4 |
[root@Lnmp ~]# cat /etc/redhat-release CentOS release 6.4 (Final) [root@Lnmp ~]# uname -a Linux Lnmp.t4x.org 2.6.32-358.el6.x86_64 #1 SMP Fri Feb 22 00:31:26 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux 默认级别(/etc/inittab):id:3:initdefault: |
Centos 7.X
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
[root@localhost ~]# cat /etc/redhat-release CentOS Linux release 7.1.1503 (Core) [root@localhost ~]# uname -a Linux localhost.localdomain 3.10.0-229.el7.x86_64 #1 SMP Fri Mar 6 11:36:42 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux [root@localhost ~]# ll /lib/systemd/system/runlevel*.target lrwxrwxrwx. 1 root root 15 Nov 8 02:38 /lib/systemd/system/runlevel0.target -> poweroff.target lrwxrwxrwx. 1 root root 13 Nov 8 02:38 /lib/systemd/system/runlevel1.target -> rescue.target lrwxrwxrwx. 1 root root 17 Nov 8 02:38 /lib/systemd/system/runlevel2.target -> multi-user.target lrwxrwxrwx. 1 root root 17 Nov 8 02:38 /lib/systemd/system/runlevel3.target -> multi-user.target lrwxrwxrwx. 1 root root 17 Nov 8 02:38 /lib/systemd/system/runlevel4.target -> multi-user.target lrwxrwxrwx. 1 root root 16 Nov 8 02:38 /lib/systemd/system/runlevel5.target -> graphical.target lrwxrwxrwx. 1 root root 13 Nov 8 02:38 /lib/systemd/system/runlevel6.target -> reboot.target [root@localhost ~]# ll /etc/systemd/system/default.target #默认运行级别 lrwxrwxrwx. 1 root root 37 Nov 8 02:42 /etc/systemd/system/default.target -> /lib/systemd/system/multi-user.target [root@localhost ~]# systemctl set-default graphical.target #修改默认运行级别方法 rm '/etc/systemd/system/default.target' ln -s '/usr/lib/systemd/system/graphical.target' '/etc/systemd/system/default.target' [root@localhost ~]# ll /etc/systemd/system/default.target lrwxrwxrwx. 1 root root 40 Nov 21 04:42 /etc/systemd/system/default.target -> /usr/lib/systemd/system/graphical.target [root@localhost ~]# systemctl set-default multi-user.target rm '/etc/systemd/system/default.target' ln -s '/usr/lib/systemd/system/multi-user.target' '/etc/systemd/system/default.target' |
申明:本站部分内容来自于百科inittabSourceByrd's Weblog-https://note.t4x.org/basic/linux-run-level/ SourceByrd's Weblog-https://note.t4x.org/basic/linux-run-level/
申明:除非注明Byrd's Blog内容均为原创,未经许可禁止转载!详情请阅读版权申明!