他们两个是用户的配置文件,位于用户的主目录文件夹下,
注意是用户的主目录,区分是不是root用户和其他用户,如果没有就自己添加。
我们平常写命令的窗口就是bash
这个窗口其实就是一个交互式
判断获取bash的方法分为loginshell和no-loginshell。
其中,loginshell是指我们通过用户名密码进行登陆打开的方式,这种方式读取的配置文件为.bash_profile。
no-loginshell是指我们通过sudo和界面下打开bash等等方式,这种方式读取的配置文件为.bashrc。
一般情况下,我们要在.bash_profile中调用.bashrc,从而保证环境全局一致。
当然系统中还有很多配置文件,这里就只说这两个。
.bashrc例如:
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
alias mysql='/home/homework/mysql/bin/mysql'
.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
其实这个就是简单的配置一个mysql