Linux CentOS下shell显示-bash-4.1$不显示用户名路径的解决方法linux
问题描述:shell
CentOS下新增一个用户,登陆进去以后shell脚本的信息以下:bash
而不是咱们常常看到的username@hostname的组合,看起来很不舒服。get
解决方案:登录
问题的缘由是由于没有配置.bash_profile的问题,能够经过配置这个文件来解决问题。配置
1.在Terminal输入:file
[plain] 方法
vi ~/.bash_profile im
2.若是没有.bash_profile能够本身添加。而后往文件中添加以下内容:脚本
[plain]
export PS1=’[\u@\h \W]\$’
注意'是英文状态下的字符。
3.输入如下指令,使更改生效:
[plain]
source ~/.bash_profile
这样,shell开始就会显示的是咱们熟悉的username@hostname的格式了,以下图: