0

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

2 Answers 2

5

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)
3
  • I think, I need to apply different IP like 127.0.1.2, to get back to original state
    – Minty
    May 12, 2012 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, 2012 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, 2012 at 16:06
1

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
1
  • 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, 2012 at 16:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .