你的 shell 可能是bash。提示设置在 bash 的初始化文件中,该文件.bashrc
位于您的主目录中。具体来说,提示是由PS1
变量设置的。它的值可以包含在显示提示时由某个值替换的转义序列。例如,MyComputer:~ me$
提示设置的结果,如
PS1='\h:\w \u\$ ' # host name colon working directory space user name dollar space
Run Code Online (Sandbox Code Playgroud)
尝试在您的末尾添加以下行.bashrc
(如果不存在则创建它):
PS1='\$ '
Run Code Online (Sandbox Code Playgroud)
如果这没有改变任何东西,那是因为您有一个登录 shell 并且没有正确的.bash_profile
. 有关说明,请参阅.bashrc 和 .bash_profile 之间的差异。小故事:创建一个.bash_profile
包含
if [ -r ~/.profile ]; then . ~/.profile; fi
case "$-" in *i*) if [ -r ~/.bashrc ]; then . ~/.bashrc; fi;; esac
Run Code Online (Sandbox Code Playgroud)