Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

When I installed ubuntu 12, my terminal was showing user@XYZ. After fiddling with some external application, now my terminal looks like this user@ABC. How to switch back to XYZ?

Thanks a lot.

UPDATED:

I changed my /etc/hosts file from

127.0.0.1   localhost


127.0.1.1   MyUbuntu

To

127.0.0.1   localhost

127.0.1.1   ubun12 server.ubun12 dev.ubun12 *.ubun12

So previously it was admin@MyUbuntu, but now it is admin@ubun12

share|improve this question
add comment

2 Answers

Are XYZ and ABC what it actually show(ed)? Because if thats the case it sounds like you've changed your machine name. You can change the terminal prompt with

export PS1="(Prompt)"

so I imagine you'd want something like

export PS1=`whoami`@`hostname`:

to show

bob@bobs-computer:

but to change your hostname you'd need

sudo hostname (new name)
share|improve this answer
    
Thanks I upadated my question to make it more clear –  Minty May 12 '12 at 15:35
    
I think, I need to apply different IP like 127.0.1.2, to get back to original state –  Minty May 12 '12 at 15:43
    
@Minty, No just change the line that starts with 127.0.1.1 in /etc/hosts to 127.0.1.1 MyUbuntu ubun12 server.ubunt12 dev.ubun12 I don't think you really want the *.ubunt12 entry. You may also need to run sudo hostname MyUbuntu. You may also need to restart, or at least logoff/logon. This answer is correct. –  Chris May 12 '12 at 15:49
    
Thanks Chris, but something really screwed up in the past 30 min. Things just stopped working. I am closing this issue because I am starting all over again and I will keep your suggestion to include that next time. Thanks –  Minty May 12 '12 at 16:06
add comment

As jackweirdy mentioned above, what you want is just get your hostname "XYZ" back, right?

just feel free to type the commands as follows,

echo "XYZ" > /etc/hostname
hostname -F /etc/hostname

Hope it helps, more for PS1 configuration, visit PS1 Configuration to customize your own prompt :D

Oh, one more thing if you want to configure your domain name as well, edit /etc/hosts

127.0.0.1        localhost.localdomain    localhost
12.34.56.78      XYZ.example.com        XYZ
share|improve this answer
    
Thanks for your help. I am starting all over again because things went wrong and I dont know where to look. But I will keep your suggestion. –  Minty May 12 '12 at 16:11
add comment

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.