PDA

View Full Version : [ubuntu] Hostname not showing properly?



vksingh
February 27th, 2010, 06:45 AM
Hi,

I am using Ubuntu 9.10. I changed the hostname by editing the file:

/etc/hostname.

But, still it is showing old hostname in the prompt. I want to know which service should I restart to reflect the change in Hostname.

Thanks,

Vivek

jswoods7
February 27th, 2010, 07:19 AM
If you don't want to restart, just run 'hostname <new hostname>'

vksingh
February 27th, 2010, 09:01 AM
Hi,

But even then , the prompt is coming like this:

vivek@old_hostname#

I want it to be:

vivek@new_hostname#

Thanks,

Vivek

jswoods7
February 27th, 2010, 07:05 PM
You'll need to restart your shell:


root@old-hostname:~# hostname new-hostname
root@old-hostname:~# bash
root@new-hostname:~# exit
exit
root@old-hostname:~#

efflandt
February 28th, 2010, 10:57 AM
I made the same mistake. You forgot to also edit /etc/hosts

You probably need to log out of X and log back in, because X uses network sockets.