0

I have changed my host and hostname by editing the files /etc/hosts and /etc/hostname.

But this won't affect what appears as my terminal prompt. It still shows my old_host@new_hostname. How to get the prompt show up new_host@new_hostname?

2 Answers 2

0

What appears at your command prompt is stored in the variable $PS1. It is generally in the format username@hostname:~$ (depending on your current directory and whether you are root of course).

It sounds like your hostname was changed successfully. I'm not sure why you edited your /etc/hosts file but I doubt it would have achieved what you're thinking it should...

Update: Here is some info on changing your username and home folder

Your options are to create a new user (and have your old home folder contents moved) or rename your old user and home folder.

You won't be able to change your username while logged in under the same account, so you have several options for getting around this:

  1. Sign in as another user (with sudo rights). Create a temporary user if necessary.
  2. Boot into Recovery Mode (hold Shift while booting), go into Advanced options for Ubuntu, select the recovery mode for the latest kernel, then select root (Drop to root shell prompt).
  3. Enable the root account and use that.

There is too much to get into here, so you should read over the content on the following links for details on the exact steps to take. Don't do anything until you feel comfortable with the steps.

How do I change my username?
http://www.ubuntututorials.com/change-username-ubuntu-12-04/
https://www.liberiangeek.net/2012/12/how-to-easily-change-your-username-in-ubuntu-12-10-quantal-quetzal/

0

@MadMike Thanks. I can see that you have understood the issue already. Hostname got changed successfully. The reason I edited /etc/hosts is to replace the old username in 127.0.1.1 field. I read somewhere that this would do the trick. While the hosts file got updated, it still didn't change what appeared on my terminal. And yes, I would like to change my username (and my homefolder as well) for consistency. As far as I know, I used an ISO and did a standard install as I am not so techy for customization. Does this sound like an answer, I am sorry for this novice approach? Thanks for the help.

You must log in to answer this question.

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