How to change Linux Terminal display username
如何更改 Linux Terminal 显示的用户名
(base) ➜ ~ whoami
xgqfrms-mbp
(base) ➜ ~ pwd
/Users/xgqfrms-mbp
(base) ➜ ~
terminal change username base
bug ❌
after install
Anaconda
navigator, terminal change username bug
(conda)
Anaconda 水蟒
conda base bug ❌
solution
https://conda.io/projects/conda/en/latest/user-guide/configuration/use-condarc.html#change-command-prompt-changeps1
vscode
(base) ➜ ~ code .zshrc
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/Users/xgqfrms-mbp/opt/anaconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
eval "$__conda_setup"
else
if [ -f "/Users/xgqfrms-mbp/opt/anaconda3/etc/profile.d/conda.sh" ]; then
. "/Users/xgqfrms-mbp/opt/anaconda3/etc/profile.d/conda.sh"
else
export PATH="/Users/xgqfrms-mbp/opt/anaconda3/bin:$PATH"
fi
fi
unset __conda_setup
# <<< conda initialize <<<
(base) ➜ ~ code .zshrc
(base) ➜ ~ conda deactivate
(/Users/xgqfrms-mbp/anaconda3) ➜ ~ code ~/.condarc
ssl_verify: true
channels:
- defaults
ssl_verify: true
channels:
- defaults
changeps1: False
OK ✅
refs
https://www.jianshu.com/p/6cdc9713c4ed
https://linux.cn/article-9192-1.html
https://www.cnblogs.com/tdcqma/p/6714492.html
https://www.jianshu.com/p/6ef9e8a4d789
https://cloud.tencent.com/developer/ask/50791
https://www.cnblogs.com/devilmaycry812839668/p/10349602.html
~/.bashrc
& ~/.zshrc
问题的源头,那就是aconda自动加入了命令到 .bashrc中, 在我们打开终端的时候自动 执行了 conda activate base 命令
https://askubuntu.com/questions/1026383/why-does-base-appear-in-front-of-my-terminal-prompt
https://apple.stackexchange.com/questions/371727/how-do-i-remove-the-source-base-from-my-terminal
https://stackoverflow.com/questions/55171696/how-to-remove-base-from-terminal-prompt-after-updating-conda
Linux $PS1
PS1 (Prompt String 1)
$ echo $PS1
https://www.cyberciti.biz/tips/howto-linux-unix-bash-shell-setup-prompt.html
https://www.linuxnix.com/linuxunix-shell-ps1-prompt-explained-in-detail/
https://linuxconfig.org/bash-prompt-basics
PS1
https://zhuanlan.zhihu.com/p/140892886
©xgqfrms 2012-2020
www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!