按照生效範圍劃分,存在兩類:
全局配置:
/etc/profile
/etc/profile.d/*.sh
/etc/bashrc
個人配置
~/.bash_profile
~/.bashrc
按照shell登陸,存在兩類:
交互式登陸:
(1) 直接通過終端輸入賬號密碼登錄
(2) su - UserName” 切換的用戶
執行順序:/etc/profile-->/etc/profile.d/*.sh -->~/.bash_profile -->/.bashrc -->/etc/bashrc
非交互式登陸:
(1)su UserName
(2)圖形界面下打開的終端
(3)執行腳本
(4)任何其它的bash實例
執行順序: /etc/profile.d/*.sh --> /etc/bashrc -->~/.bashrc 其中docker就屬於此類
按照生效範圍劃分,存在兩類:
profile類:爲交互式登錄的shell提供配置:
全局:/etc/profile, /etc/profile.d/*.sh
個人:~/.bash_profile
功用:
(1)用於定義環境變量
(2)運行命令或腳本
profile類:bashrc類:爲非交互式和交互式登錄的shell提供配置:
全局:/etc/bashrc
個人:~/.bashrc
功用:
(1)定義命令別名和函數
(2)定義本地變量