天天看點

CentOS下shell顯示-bash-4.1$不顯示使用者名路徑

導讀 Linux CentOS下shell顯示-bash-4.1$不顯示使用者名路徑的解決方法。

問題描述:

CentOS下新增一個使用者,登入進去之後shell腳本的資訊如下:

-bash-4.1$ \
-bash-4.1$ \      

而不是我們經常看到的[email protected]的組合,看起來很不舒服。

解決方案:

問題的原因是因為沒有配置.bash_profile的問題,可以通過配置這個檔案來解決問題。

1.在Terminal輸入:

vi ~/.bash_profile

2.如果沒有.bash_profile可以自己添加。然後往檔案中添加如下内容:

export PS1=’[u@h W]$’

注意'是英文狀态下的字元。

3.輸入以下指令,使更改生效:

[plain]

source ~/.bash_profile

這樣,shell開始就會顯示的是我們熟悉的[email protected]的格式了.

[[email protected] ~]$      

本文原創位址:https://www.linuxprobe.com/linux-centos-bash.html

版權聲明:本文為CSDN部落客「weixin_34238642」的原創文章,遵循CC 4.0 BY-SA版權協定,轉載請附上原文出處連結及本聲明。

原文連結:https://blog.csdn.net/weixin_34238642/article/details/91972050