在 Mac 系统中更推荐修改 ~/.bash_profile而不是 ~/.bashrc。原因是在 Mac 系统下,~/.bashrc仅会本次生效,一旦关闭 shell 就会失效。
在命令行中输入以下内容,打开.bash_profile文件:
vim ~/.bash_profile
添加你自定义的指令,例如:
alias la = 'ls -a'
保存并退出:ESC + :wq
ESC + :wq
更新配置文件
. ~/.bash_profile