目錄結(jié)構(gòu)
1./etc/inittab(運(yùn)行級(jí)別)
1.1 centOS 6 運(yùn)行級(jí)別
0. 關(guān)機(jī)
1. 單用戶模式 (root用戶密碼忘記了 服務(wù)故障無法開機(jī) 默認(rèn)沒有網(wǎng)絡(luò))
2. 多用戶模式 沒有NFS(沒有網(wǎng)絡(luò))
3. 完全的多用戶模式 命令行模式 文本模式 (工作默認(rèn))
4. 未使用
5. 圖形化模式
6. 重啟
1.2 centOS 7 運(yùn)行級(jí)別
0. 關(guān)機(jī) poweroff
1. 救援模式 rescue
2. 多用戶模式 multi-user
3. 多用戶模式 multi-user
4. 多用戶模式 multi-user
5. 圖形化模式 graphical
6. 重啟 reboot
1.3 修改運(yùn)行級(jí)別
臨時(shí)修改
centos 6和7
修改: init 要修改的運(yùn)行級(jí)別
查看: runlevel
永久修改
centos 6
修改運(yùn)行級(jí)別:
[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 啟動(dòng)流程
centos 6 vs centos 7
https://www.processon.com/view/link/5bffde0ae4b0f012f2382181
centos 6 是串行啟動(dòng),啟動(dòng)較慢
centos 7 是并行啟動(dòng),啟動(dòng)較快
2. /etc/profile
/etc/profile:環(huán)境變量 別名(企業(yè)常用)
例如:別名:ls -l = ll ; 環(huán)境變量:pwd=/root
/etc/profile 國(guó)法
/etc/bashrc (函數(shù)別名) 國(guó)法
~/.bash_profile 家規(guī)
~/.bashrc 家規(guī)
alias:顯示系統(tǒng)別名
env:顯示系統(tǒng)中的一些環(huán)境變量
說明:
在 ~/.bashrc和 ~/.bash_profile 下設(shè)置的系統(tǒng)變量名root用戶不必遵守
在 ~/.bashrc和 ~/.bash_profile 下設(shè)置的系統(tǒng)變量名在顯示時(shí)優(yōu)先于root下設(shè)置的系統(tǒng)變量名
普通用戶無法修改/etc/profile(系統(tǒng)變量)和/etc/bashrc(函數(shù)別名),只能修改家目錄下的/.bashrc和/.bash_profile
3. /etc/motd
/etc/motd:登陸后顯示編輯的內(nèi)容
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:
*
* 老豬保佑,永無宕機(jī)
* _
* |)
* _._ _..._ .-', _.._ ))
* '-. ` --- ' /-._.-' '\`)
* ) -|- \ '.
* / --- | \
* | p p / |
* \ .-. ;
* '-('' ).-' ,' ;
* '-; | .' 0
* \ \ / 0
* | 7 .__ _.-\ \ 0
* | | | ``/ /` / 0
* /,_| | /,_/ / 000
* /,_/ '`-' 00000
*
* 心中自有青山在,無需隨人看桃花 --- huang jiao jiao
4. /etc/issue
/etc/issue:登錄前顯示編輯過的內(nèi)容
5. /etc/init.d
/etc/init.d:存放了系統(tǒng)一系列管理(啟動(dòng)/停止)腳本 /etc/init.d是指向/etc/rc.d/init.d的軟鏈接
6. /usr/local
/usr/local:用戶級(jí)的程序目錄,可以理解為C:/Progrem Files/。用戶自己編譯的軟件默認(rèn)會(huì)安裝到這個(gè)目錄下
7. /var/log/messages
/var/logmessages:記錄系統(tǒng)的默認(rèn)日志
8. /var/secure
/var/secure:記錄用戶登陸信息
/proc/cpuinfo
/proc/cpuinfo:cpu信息
/proc/meminfo
/proc/meminfo:內(nèi)存信息
/proc/mounts
/proc/mounts:記錄的掛載信息
/proc/loadavg
/proc/loadavg:平均負(fù)載,衡量系統(tǒng)是否繁忙
命令
lscpu:查看CPU重要信息
free:查看內(nèi)存重要信息
w:查看系統(tǒng)負(fù)載