0
点赞
收藏
分享

微信扫一扫

Linux ❀ 系统运行级别概述(如何互相切换命令行与图形化界面)


文章目录

  • ​​1、运行级别​​
  • ​​2、系统开启执行脚本文件​​

1、运行级别

  • 0 :关机;
  • 1 :单用户模式;
  • 2 :不完全的命令模式,不包含NFS服务;
  • 3 :完全的命令模式,标准字符界面;
  • 4 :保留;
  • 5 :图形模式,需要安装才可以正常跳转,否则客户端会报错;
  • 6 :重新启动;

查询并修改当前系统级别

[root@Redhat8 ~]# runlevel 
N 5
#N所处位置代表上一级系统级别,N = None;5所处位置代表当前级别
[root@Redhat8 ~]# init 3
[root@Redhat8 ~]# runlevel
5 3

#注意:不建议使用init做重启或关机操作,容易造成数据丢失!
[root@Redhat8 ~]# poweroff /关机
[root@Redhat8 ~]# reboot /重启

2、系统开启执行脚本文件

[root@Redhat8 ~]# ll /etc/rc.local 
lrwxrwxrwx. 1 root root 13 Mar 24 2020 /etc/rc.local -> rc.d/rc.local

[root@Redhat8 ~]# cat /etc/rc.local
#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.

touch /var/lock/subsys/local
#将需要执行的命令添加在最下面即可,系统重启会自动执行此脚本内的命令
[root@Redhat8 ~]# cat /mnt/isolinux/grub.conf 
#debug --graphics
default=1
splashimage=@SPLASHPATH@
timeout 60
hiddenmenu
title Install Red Hat Enterprise Linux 8.2
findiso
kernel @KERNELPATH@ @ROOT@ quiet
initrd @INITRDPATH@
title Test this media & install Red Hat Enterprise Linux 8.2
findiso
kernel @KERNELPATH@ @ROOT@ rd.live.check quiet
initrd @INITRDPATH@


举报

相关推荐

0 条评论