Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

For some reason I logged into my CentOS6 server and at the beginning of every line it normally shows


Now it shows


What does this mean? And how to I get it back to normal??? I'm very new to CentOS...

share|improve this question

migrated from serverfault.com Dec 24 '12 at 16:49

This question came from our site for system and network administrators.

Google: /etc/skel. –  quanta Dec 24 '12 at 3:27
What does echo $PS1 show? Did you su to get root instead of su -? –  jscott Dec 24 '12 at 3:40
@jscott I'm logged into root, and yes I did su. not su - how would I get out of that? –  Necro. Dec 24 '12 at 3:42
ls -a /root/ | egrep '^\.'? –  quanta Dec 24 '12 at 3:53
@Necro Posted an answer, let me know if that helps. –  jscott Dec 24 '12 at 16:37

6 Answers 6

I had the same issue, here’s how I solved it:

One of two things happened. Either the directory /root was deleted; or a missing / corrupt .bashrc file in /root (.bashrc sources /etc/bashrc, which sets the prompt), you can run the following command to restore the original files (which are copied automatically when the root or any user account is created). Run this command as the user who is having problems OR define the destination path to /home/directory/user/

cp -v /etc/skel/.bash* ~/ (if logged in as user) cp -v /etc/skel/.bash* /home/user/ (run as root)

Should replace the .bash_logout, .bash_profile, .bashrc - exit terminal and log back in. The -bash-4.1# should now be gone!

share|improve this answer

Did you by any chance try and edit your .bashrc file?

There is a backup copy located here:


To restore root run this:

cp /etc/skel/.bashrc /root/.bashrc
share|improve this answer

Run this command in your terminal:

export PS1='[\u@\h \W]\$ '

If you want to show this prompt show after you reboot, you can try this (with su):

echo "export PS1='[\u@\h \W]\$ '" > /etc/profile.d/bash_prompt.sh

more information:

man bash

share|improve this answer
Thanks a lot... friend –  K.K Patel Jul 15 '13 at 13:10

Per your comment, it sounds like you've done a su, to switch to the root user, rather than su -. The trailing - will make the shell a login shell, without it you may notice your root user environment is "off".

To exit the su session, just type exit Enter or press ctrl + d. Then re-enter the session using su -. See the man page, man su, for more details.

share|improve this answer

It means that in one place your command prompt was changed by the contents of .profile (or the system profile)....in the second case, your prompt was not changed.

BTW, what is "normal". In my opinion, the default of the application (the second entry) is normal. As in other things "normal" means different things to different people. In UNIXland there are so many ways of doing things, a tag like this really has no meaning.

I'd strong suggest you closely study the man page or look for a good book on bash.

share|improve this answer
Please look at my edit. –  Necro. Dec 24 '12 at 3:32
My answer still stands....please do get a shell book if you going to use the bash shell a lot. –  mdpc Dec 24 '12 at 3:35
Okay, I will get a book, but until I do that, how do I revert back to the [root@hostname]# ? –  Necro. Dec 24 '12 at 3:39
What I would say is reexecute the system profile using the '.' command...assumming your system profile provides such a prompt. –  mdpc Dec 24 '12 at 3:41

It means you're using the bash shell. Version 4.1.

share|improve this answer
How do I get out of this so it will just show [root@hostname]# and my current folder and stuff? –  Necro. Dec 24 '12 at 3:29
Check the man page and see how you can set your prompt. –  mdpc Dec 24 '12 at 3:43

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.