CentOS under the shell display-bash-4.1$ does not display the user name path resolution
Problem Description:
A new user is added under CentOS, and the shell script information is as follows when logged in:
650) this.width=650; "src=" Http://up.2cto.com/2013/0605/20130605091807247.jpeg "style=" border-width:0px;padding:0 px;margin:0px;list-style:none;width:118px;height:46px; "alt=" 20130605091807247.jpeg "/>
Rather than the combination of [email protected] we often see, it looks uncomfortable.
The reason is that when you create a user, if you specify the-m parameter, and therefore do not create a user home directory, so the system will not be in the creation of users, automatically copy the user environment variable files in the/etc/skel directory to the user home directory, it will cause these files do not exist, appear-bash-4.1# Problem, just copy it manually.
workaround One, not validated
[Email protected] 3307]# ls-a/etc/skel/
. .. . bash_logout. Bash_profile. BASHRC
Direct Cp-a/etc/skel/* to the home directory.
workaround Two, verified that this method is valid
-bash-4.1#
Above this is the state of the previous settlement
Here's how:
1. In Terminal input:
[Plain]
VI ~/.bash_profile
2. If no. Bash_profile can be added by itself. Then add the following to the file:
[Plain]
Export ps1= ' [\[email protected]\h \w]\$ '
Note ' is the character in the English state.
3. Enter the following instructions for the changes to take effect:
[Plain]
SOURCE ~/.bash_profile
In this way, the shell will initially display the familiar [email protected] format, as shown below:
[[Email Protected]_back ~]#
This article is from the "Lanzhou Linux operation and Maintenance" blog, please be sure to keep this source http://linuxzkq.blog.51cto.com/9379412/1662520
CentOS under the shell display-bash-4.1# does not display the user name path resolution