Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.


I changed my /etc/hosts file from   localhost   MyUbuntu

To   localhost   ubun12 server.ubun12 dev.ubun12 *.ubun12

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

share|improve this question

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


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, to get back to original state – Minty May 12 '12 at 15:43
@Minty, No just change the line that starts with in /etc/hosts to 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

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        localhost.localdomain    localhost        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

Your Answer


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.