bashrc和bash profile的生效時間

2021-09-13 19:27:02 字數 389 閱讀 9980

vim  ~/.bashrc 後source ~/.bashrc立即生效,但在下次使用者登入時需要重新source

而 ~/.bash_profile檔案裡面的環境變數,一旦source成功後,下次使用者登入時不在需要source

同時在conda虛擬環境下 可以source  ~/.bash_profile檔案,不能source ~/.bashrc檔案

.bash_profile和.bashrc檔案裡面的效力更強,系統搜尋環境變數可能是先在bash_profile檔案裡面搜尋,後在bashrc檔案裡面搜尋。

我通過在這兩個檔案裡面設定了不同版本的cuda路徑,使用nvcc --version檢視cuda的版本時,發現總是讀取的bash_profile檔案的路徑,說明bash_profile的效力更強。

bash profile和 bashrc的什麼區別

etc profile 此檔案為系統的每個使用者設定環境資訊,當使用者第一次登入時,該檔案被執行.並從 etc profile.d目錄的配置檔案中蒐集shell的設定.etc bashrc 為每乙個執行bash shell的使用者執行此檔案.當bash shell被開啟時,該檔案被讀取.bash p...

bashrc和 bash profile的區別

etc profile 此檔案為系統的每個使用者設定環境資訊,當使用者第一次登入時,該檔案被執行。並從 etc profile.d目錄的配置檔案中蒐集shell的設定.其中的設定對所有的使用者有用 etc bashrc 為每乙個執行bash shell的使用者執行此檔案.當bash shell被開啟...

bash profile和 bashrc的區別

bash profile和.bashrc的區別 1 etcprofile 此檔案為系統的每個使用者設定環境資訊,當使用者第一次登入時,該檔案被執行.並從etcprofile.d目錄的配置檔案中蒐集shell的設定。2 etcbashrc 為每乙個執行bash shell的使用者執行此檔案.當bash...