close

此文章內容參考自 柏青哥的SUSE Linux 一書

當使用者成功登入系統時,馬上會取得一個 login shell ( 如果於此 shell 下再去啟用其他的 subshell,則稱為 non-login shell ),同時也取得了 shell 所提供的環境變數。您可以藉著修改一些環境設定檔來調整這些環境變數的內容。以下就是有關於環境設定檔的說明:

/etc/profile
使用者在登入期間,首先會被 bash 所讀取的檔案。

~/.bash_profile
如果這個檔案存在,則在 bash 執行完 /etc/profile 後,會接著執行這個檔案的內容。

~/.bash_login
如果 ~/.bash_profile 不存在,則執行此檔。

~/.profile
如果 ~/.bash_profile 及 ~/.bash_login 都不存在,則執行此檔。SuSE 就是使用這個檔案。

~/.bashrc
此檔在登入期間也會被執行。

/etc/bash.bashrc
在載入 /etc/profile 的過程,也會執行 bash.bashrc 檔案。

 

/etc/profile 及 /etc/bash.bashrc 的設定內容,可以套用在所有使用者的操作環境上,但只有 root 能去做設定,至於使用者則可以在自己家目錄下的 .profile 及 .bashrc 這兩個檔案做設定,以調整成自己想要的操作環境。

login shell:
bash 會去讀取 /etc/profile 及 ~/.bash_profile、~/.bash_login、~/.profile 三者之一

non-login shell:
只會讀取 ~/.bashrc 而已。

 

PS.如果要換自已的 Shell,就輸入chsh就可以改了

END~

arrow
arrow
    全站熱搜

    Ching-Wei 發表在 痞客邦 留言(0) 人氣()