# 设置默认提示符 export PS1="%n@%m %c %~ $ " # 设置别名 alias ll='ls -al' alias la='ls -A' # 加载插件 plugins=(git) # 加载 Oh My Zsh source /usr/local/share/oh-my-zsh/oh-my-zsh.sh 3..bash_profile 作用: .bash_profile是 Bash shell 的用户级配置文件。 它在每次用户登录...
保存后退出,source ~/.bash_profile,执行生效的指令 由于我每次关闭窗口后,都要重新执行source 才能重新生效,固将路径添加到了~/.zshrc文件里解决了。 据了解,计算机每次都会默认执行~/.zshrc 文件,所以添加到这里保证肯定会执行,也可在~/.zshrc文件里加一句 source ~/.bash_profile。 “~” 你的home目录,在...
.bash_profile 文件中所修改的环境变量,只会对当前窗口起效,还要手动 source ~/.bash_profile 之后才能使用; .zshrc 文件则像是开机启动的配置文件,在电脑启动后生效。 所以,我们可以在 .zshrc 文件中,添加一句 source $HOME/.bash_profile 即可解决原来需要手动 source 才能使用的问题。
在登录时(如 SSH 登录)应配置.bash_profile 在普通的终端会话中应配置.bashrc 如果使用 Zsh: 所有自定义设置都应放入.zshrc 在实际使用中,如果希望更好地管理多个环境,可以将大部分公共配置放入一个文件(如.bash_common)并在各自的配置文件中引用它。例如: #在 .bash_profile 或 .zshrc 中引入公共配置 if[-f...
保存后退出,source ~/.bash_profile,执行生效的指令 由于我每次关闭窗口后,都要重新执行source 才能重新生效,固将路径添加到了~/.zshrc文件里解决了。 据了解,计算机每次都会默认执行~/.zshrc 文件,所以添加到这里保证肯定会执行,也可在~/.zshrc文件里加一句 source ~/.bash_profile。
~/.bash_profile ~/.bash_profile 文件是针对 Bash shell 的配置文件。当 Bash shell 以 login 方式执行时,它会读取 ~/.bash_profile 文件。如果该文件不存在,它会尝试读取 ~/.bash_login 文件。如果两者都不存在,它则会读取 ~/.profile 文件。也就是说,当你作为登录用户使用 Bash shell 的时候,这个文件...
我自己在.bash_profile中存了一些环境变量,比如 export PAAAATH = 'xxx' 然后每次新开item2窗口,都需要执行source ~/.bash_profile里面的PAAAATH才会生效。 网上说把source ~/.bash_profile放到.zshrc的最下面,于是我修改 # nvm config export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && \....
在终端操作中,.bash_profile和.zshrc是用于配置Bash和Zsh shell环境的关键文件。Bash shell以login方式运行时,会读取.bash_profile文件,而文件不存在时,会尝试读取.bash_login或.profile文件。这意味着,.bash_profile在用户登录时初始化Bash shell环境设置。相比之下,.zshrc文件针对Zsh shell,无论...
.bash_profile 顾名思义,是每个 Profile(用户)的 Bash 初始化文件。 .zshrc 顾名思义,是 zsh 的 RunControl(运行控制)文件。 系统启动时会先加载 /etc/profile、/etc/paths 这俩。 等你登录了一个用户后,有 ~/.bash_profile 就加载它,没有它就加载 ~/.bash_login 和~/.profile。 .zshrc 是zsh 启动...
ForBash: .bashrc: For interactive non-login shells. .bash_profile: For login shells, and if.bash_logindoesn't exist, Bash reads this. .bash_login: Read after.bash_profilefor login shells. .profile: Acts as a fallback if neither.bash_profilenor.bash_loginis found. ...