歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> Bash常用的幾個配置文件

Bash常用的幾個配置文件

日期:2017/2/28 14:29:12   编辑:Linux教程

Login shells讀下面的啟動文件:

文件

內容

/etc/profile 對所有用戶開放的全局配置文件 ~/.bash_profile 某個用戶個人的啟動文件,能用作個人的全局設置 ~/.bash_login 如果 ~/.bash_profile找不到,則bash嘗試讀取這個腳本 ~/.profile 如果這兩個文件~/.bash_profile, ~/.bash_login 都找不到,bash就讀取這個文件,這是個默認文件

NOTE:

  • export PATH=$PATH:directory #只改變當下bash的環境配置,下次登錄無效
  • source .bash_profile #改變全局變量,用source使之生效
  • .bash_logout #退出時,該腳本做的操作,比如說清空等

Non-login shell讀取下面的文件:

文件

內容

/etc/bash.bashrc 對所有用戶開放的全局配置文件 ~/.bashrc 某個用戶個人的啟動文件,能用作個人的全局設置

可以看下.bash_profile腳本內容:

# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
	. ~/.bashrc
fi

# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export PATH

Bash腳本15分鐘進階教程 http://www.linuxidc.com/Linux/2014-04/100750.htm

10個 Linux/Unix下 Bash 和 KSH shell 的作業控制實例 http://www.linuxidc.com/Linux/2014-03/98159.htm

Ubuntu下shell腳本運行異常:Bash和dash的區別 http://www.linuxidc.com/Linux/2013-10/91100.htm

Bash腳本之for語句if語句以及各種測試語句 http://www.linuxidc.com/Linux/2013-07/87922.htm

什麼是Bash Shell的內建(build in)命令 http://www.linuxidc.com/Linux/2013-06/86039.htm

Copyright © Linux教程網 All Rights Reserved