How to change Linux Terminal display username All In One
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 ✅
vscode
$ 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 ✅
demos
Raspberry Pi
4B
$ hostname -I
192.168.18.168 fd80:eae6:1258:0:3e37:1ab6:357c:1dba
$PS1
$ echo $PS1
\[\e]0;\u@\h: \w\a\]${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w \$\[\033[00m\]
https://www.cnblogs.com/xgqfrms/p/17267344.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
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
set
& unset
set [ {+|-}options | {+|-}o [ option_name ] ] ... [ {+|-}A [ name ] ]
[ arg ... ]
Set the options for the shell and/or set the positional
parameters, or declare and set an array. If the -s option is
given, it causes the specified arguments to be sorted before
assigning them to the positional parameters (or to the array
name if -A is used). With +s sort arguments in descending
order. For the meaning of the other flags, see zshoptions(1).
Flags may be specified by name using the -o option. If no option
name is supplied with -o, the current option states are printed:
see the description of setopt below for more information on the
format. With +o they are printed in a form that can be used as
input to the shell.
If the -A flag is specified, name is set to an array containing
the given args; if no name is specified, all arrays are printed
together with their values.
If +A is used and name is an array, the given arguments will
replace the initial elements of that array; if no name is
specified, all arrays are printed without their values.
The behaviour of arguments after -A name or +A name depends on
whether the option KSH_ARRAYS is set. If it is not set, all
arguments following name are treated as values for the array,
regardless of their form. If the option is set, normal option
processing continues at that point; only regular arguments are
treated as values for the array. This means that
set -A array -x -- foo
sets array to `-x -- foo' if KSH_ARRAYS is not set, but sets the
array to foo and turns on the option `-x' if it is set.
If the -A flag is not present, but there are arguments beyond
the options, the positional parameters are set. If the option
list (if any) is terminated by `--', and there are no further
arguments, the positional parameters will be unset.
If no arguments and no `--' are given, then the names and values
of all parameters are printed on the standard output. If the
only argument is `+', the names of all parameters are printed.
For historical reasons, `set -' is treated as `set +xv' and `set
- args' as `set +xv -- args' when in any other emulation mode
than zsh's native mode.
$ man zshbuiltins
# $ man zshbuiltins | grep set
# Unknown locale, assuming C
$ locale
LANG=""
LC_COLLATE="C"
LC_CTYPE="UTF-8"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=
# fix
$ export LANG="en_US.UTF-8"
$ locale
LANG="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_CTYPE="UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_ALL=
https://pubs.opengroup.org/onlinepubs/007904875/utilities/set.html
unset [ -fmv ] name ...
Each named parameter is unset. Local parameters remain local
even if unset; they appear unset within scope, but the previous
value will still reappear when the scope ends.
Individual elements of associative array parameters may be unset
by using subscript syntax on name, which should be quoted (or
the entire command prefixed with noglob) to protect the
subscript from filename generation.
If the -m flag is specified the arguments are taken as patterns
(should be quoted) and all parameters with matching names are
unset. Note that this cannot be used when unsetting associative
array elements, as the subscript will be treated as part of the
pattern.
The -v flag specifies that name refers to parameters. This is
the default behaviour.
unset -f is equivalent to unfunction.
https://pubs.opengroup.org/onlinepubs/007904875/utilities/unset.html
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
©xgqfrms 2012-2021
www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!
原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!
本文首发于博客园,作者:xgqfrms,原文链接:https://www.cnblogs.com/xgqfrms/p/13439115.html
未经授权禁止转载,违者必究!
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· .NET10 - 预览版1新功能体验(一)
2019-08-05 Dart & basic
2019-08-05 Flutter & package & publish
2019-08-05 Flutter & Components & Widgets
2019-08-05 Flutter & Network & Storage
2019-08-05 Flutter & Animation
2019-08-05 Flutter & layout
2019-08-05 Flutter 学习路径