Linux CentOS下shell显示-bash-4.1$不显示用户名路径的解决方法。

问题描述:
CentOS下新增一个用户,登录进去之后shell脚本的信息如下:
-bash-4.1$ \
-bash-4.1$ \
而不是我们经常看到的username@hostname的组合,看起来很不舒服。
解决方案:
问题的原因是因为没有配置.bash_profile的问题,可以通过配置这个文件来解决问题。
1.在Terminal输入:
vi ~/.bash_profile
2.如果没有.bash_profile可以自己添加。然后往文件中添加如下内容:
export PS1=’[u@h W]$’
注意’是英文状态下的字符。
3.输入以下指令,使更改生效:
[plain]
source ~/.bash_profile
这样,shell开始就会显示的是我们熟悉的username@hostname的格式了.
[leilei@api ~]$
以上就是良许教程网为各位朋友分享的Linu系统相关内容。想要了解更多Linux相关知识记得关注公众号“良许Linux”,或扫描下方二维码进行关注,更多干货等着你 !
