Linux系統環境變數檔案解析(etc/profile ,/etc/bashrc ,~/.bash_profile)
在不同的 Linux 系統下,以下檔案可能沒有或是檔名不同,/etc/profile 中設定的變數(全域性)的作用於所有使用者,~/.bashrc 等設定的變數(區域性)只能繼承 /etc/profile 中的變數。
-
etc/profile
此檔案為系統的所有使用者設定環境資訊,當使用者第一次登入時,該檔案被執行,並從 /etc/profile.d 目錄的配置檔案中搜集shell的設定。 -
/etc/bashrc
為每一個執行 bash shell 的使用者執行此檔案,當 bash shell 被開啟時,該檔案被讀取。 -
~/.bash_profile
每個使用者都可使用該檔案輸入專用於自己使用的shell資訊,當使用者登入時,該檔案僅執行一次,預設情況下,此檔案設定一些環境變數,執行使用者的 .bashrc 檔案. -
~/.bashrc
該檔案包含專用於你的 bash shell 的 bash 資訊,當登入時以及每次開啟新的 shell 時,該檔案被讀取。新增變數使用 PATH=$PATH:/usr/local/bin/nodejs ,使用 : 分割表示並列。 -
~/.bash_logout
當每次退出系統(退出 bash shell)時,執行該檔案。
呼叫順序
登入且登入 shell 是bash時
/etc/profile
~/.bash_profile
~/.bash_login
~/.profile
登入 bash 退出時
~/.bash_logout
當啟動一個互動的 bash 時
~/.bashrc
相關文章
- linux系統環境變數.bash_profile/bashrc檔案Linux變數
- Linux下環境變數配置方法梳理(.bash_profile和.bashrc的區別)Linux變數
- Linux下/etc/profile、~/.bash_profile等幾個檔案的執行過程Linux
- /etc/profile、~/.bash_profile等幾個檔案的執行過程
- cygwin 的 /etc/home/XXXX 目錄下沒有.bash_profile 、 .inputrc 、 .bashrc 檔案
- linux下 /etc/profile、~/.bash_profile ~/.profile的執行過程Linux
- 使.bash_profile 檔案中環境變數馬上生效的命令變數
- Mac下配置環境變數重啟後不生效解決(.bash_profile vs .bashrc)(bash/zsh下不載入.bashrc問題解決)...Mac變數
- 【Linux/etc/profile檔案詳解 】Linux
- linux下系統啟動時,幾個配置檔案 /etc/profile、~/.bash_profile 等幾個檔案的執行過程,先後順序Linux
- .bash_profile和.bashrc等等的區別
- linux的umask以及登入Linux時/etc/profile、~/.bash_profile等幾個檔案的執行過程Linux
- Mac-每次都要執行source ~/.bash_profile環境變數才生效Mac變數
- linux系統環境變數Linux變數
- Linux的.bash_profile和.bashrc與子Shell的關係Linux
- .bash_profile和.bashrc的什麼區別(轉)
- linux系統設定環境變數Linux變數
- 【Shell】【Tips】Linux的.bash_profile和.bashrc與子Shell的關係Linux
- 詳細解析Linux /etc/passwd檔案Linux
- 簡單介紹Linux環境變數檔案Linux變數
- Linux系統中的/etc/shadow檔案超詳細內容解析Linux
- linux中的配置檔案/etc/profile和.bashfile 的區別Linux
- Oracle for Linux : .bash_profileOracleLinux
- linux系統安裝jdk,配置環境變數LinuxJDK變數
- Linux:修改系統 php 預設環境變數LinuxPHP變數
- 環境變數與檔案查詢變數
- 在Linux系統環境下使用GFS檔案系統Linux
- Linux 新增環境變數和刪除環境變數Linux變數
- 【Linux】環境變數!!!Linux變數
- Linux 環境變數Linux變數
- linux環境下使用XFS檔案系統(轉)Linux
- shell全域性(系統)環境變數變數
- AIX 修改系統檔案 /etc/security/limitsAIMIT
- redhat5之初始化指令碼檔案呼叫次序.bash_profile_.bashrc_bashrcRedhat指令碼
- Linux 學習筆記--環境變數與檔案查詢Linux筆記變數
- Linux系統設定環境變數是怎樣的Linux變數
- Linux系統/etc/security/limits.conf檔案的作用LinuxMIT
- Linux教程-系統管理-/etc下的檔案詳解(轉)Linux