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

[root@hostname]# 

Now it shows

-bash-4.1#

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

share|improve this question
    
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
add comment

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

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

5 Answers

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

There is a backup copy located here:

/etc/skel/.bashrc

To restore root run this:

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

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
add comment

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
add comment

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
add comment

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
add comment

Your Answer

 
discard

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