How to Change Hostname on Ubuntu 11.10

Share this Article :

This post will shows you how to quickly change hostname on Ubuntu 11.10. Assumed that you have root account access on Ubuntu 11.10 linux server. There are two way to change the hostname on Ubuntu serve or desktop. Either you modify /etc/hostname using vi command or simply run the echo command as shown on example below :

1. Modify /etc/hostname using echo command :

[email protected]:~# echo ehowstuff.example.com > /etc/hostname

2. Modify /etc/hostname using vi editor and enter your new hostname :

[email protected]:~# vi /etc/hostname

This steps is required for both above steps (1) and (2). To get the new hostname to take effect, restart the hostname as below :

[email protected]:~# /etc/init.d/hostname restart
Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service hostname restart

Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the stop(8) and then start(8) utilities,
e.g. stop hostname ; start hostname. The restart(8) utility is also available.
hostname stop/waiting

How to check the updated or current hostname :

[email protected]:~# hostname
ehowstuff.example.com

Leave a Reply