shell的類型(站在用戶登錄登錄的角度)
登錄式shell
- 正常通過某終端登錄
- su – USERNAME
- su -l USERNAME
非登錄式shell
- su USERNAME
- 圖形終端下打開命令窗口
- 自動執行的shell腳本
用戶登錄時相關的bash配置文件
全局配置文件
- /etc/profile
- /etc/profile.d/*.sh
- /etc/bashrc
個人配置文件
- ~/.bsah_profile
- ~/.bashrc
profile類的文件:
設定環境變數
運行命令或腳本
bashrc類的文件:
設定本地變數
定義命令別名
用戶登錄時載入bash配置文件的過程
登錄式shell載入配置文件過程
/etc/profile --> /etc/profile.d/*.sh --> ~/.bash_profile --> ~/.bashrc --> /etc/bashrc
非登錄式shell載入配置文件過程
~/.bashrc --> /etc/bashrc --> /etc/profile.d/*.sh
原創文章,作者:投稿專員,如若轉載,請註明出處:https://www.506064.com/zh-tw/n/219438.html