目录结构
1./etc/inittab(运行级别)
1.1 centOS 6 运行级别
0. 关机
1. 单用户模式 (root用户密码忘记了 服务故障无法开机 默认没有网络)
2. 多用户模式 没有NFS(没有网络)
3. 完全的多用户模式 命令行模式 文本模式 (工作默认)
4. 未使用
5. 图形化模式
6. 重启
1.2 centOS 7 运行级别
0. 关机 poweroff
1. 救援模式 rescue
2. 多用户模式 multi-user
3. 多用户模式 multi-user
4. 多用户模式 multi-user
5. 图形化模式 graphical
6. 重启 reboot
1.3 修改运行级别
临时修改
centos 6和7
修改: init 要修改的运行级别
查看: runlevel
永久修改
centos 6
修改运行级别:
[root@lidiao ~]# vim /etc/inittab
# inittab is no longer used when using systemd.
#
# ADDING CONFIGURATION HERE WILL HAVE NO EFFECT ON YOUR SYSTEM.
#
# Ctrl-Alt-Delete is handled by /usr/lib/systemd/system/ctrl-alt-del.target
#
# systemd uses 'targets' instead of runlevels. By default, there are two main targets:
#
# multi-user.target: analogous to runlevel 3
# graphical.target: analogous to runlevel 5
#
# To view current default target, run:
# systemctl get-default
#
# To set a default target, run:
# systemctl set-default TARGET.target
永久修改
centos 7
修改:
[root@lidiao ~]# systemctl set-default graphical.target
Removed symlink /etc/systemd/system/default.target.
Created symlink from /etc/systemd/system/default.target to /usr/lib/systemd/system/graphical.target.
查看:
[root@lidiao ~]# systemctl get-default
graphical.target
1.4 启动流程
centos 6 vs centos 7
https://www.processon.com/view/link/5bffde0ae4b0f012f2382181
centos 6 是串行启动,启动较慢
centos 7 是并行启动,启动较快
2. /etc/profile
/etc/profile:环境变量 别名(企业常用)
例如:别名:ls -l = ll ; 环境变量:pwd=/root
/etc/profile 国法
/etc/bashrc (函数别名) 国法
~/.bash_profile 家规
~/.bashrc 家规
alias:显示系统别名
env:显示系统中的一些环境变量
说明:
在 ~/.bashrc和 ~/.bash_profile 下设置的系统变量名root用户不必遵守
在 ~/.bashrc和 ~/.bash_profile 下设置的系统变量名在显示时优先于root下设置的系统变量名
普通用户无法修改/etc/profile(系统变量)和/etc/bashrc(函数别名),只能修改家目录下的/.bashrc和/.bash_profile
3. /etc/motd
/etc/motd:登陆后显示编辑的内容
Connecting to 10.0.0.200:22...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.
WARNING! The remote SSH server rejected X11 forwarding request.
Last login: Wed Apr 3 15:56:21 2019 from 10.0.0.1
* 2019:
*
* 老猪保佑,永无宕机
* _
* |)
* _._ _..._ .-', _.._ ))
* '-. ` --- ' /-._.-' '\`)
* ) -|- \ '.
* / --- | \
* | p p / |
* \ .-. ;
* '-('' ).-' ,' ;
* '-; | .' 0
* \ \ / 0
* | 7 .__ _.-\ \ 0
* | | | ``/ /` / 0
* /,_| | /,_/ / 000
* /,_/ '`-' 00000
*
* 心中自有青山在,无需随人看桃花 --- huang jiao jiao
4. /etc/issue
/etc/issue:登录前显示编辑过的内容
5. /etc/init.d
/etc/init.d:存放了系统一系列管理(启动/停止)脚本 /etc/init.d是指向/etc/rc.d/init.d的软链接
6. /usr/local
/usr/local:用户级的程序目录,可以理解为C:/Progrem Files/。用户自己编译的软件默认会安装到这个目录下
7. /var/log/messages
/var/logmessages:记录系统的默认日志
8. /var/secure
/var/secure:记录用户登陆信息
/proc/cpuinfo
/proc/cpuinfo:cpu信息
/proc/meminfo
/proc/meminfo:内存信息
/proc/mounts
/proc/mounts:记录的挂载信息
/proc/loadavg
/proc/loadavg:平均负载,衡量系统是否繁忙
命令
lscpu:查看CPU重要信息
free:查看内存重要信息
w:查看系统负载