How to Change Hostname on Ubuntu 11.10

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 :

root@ubuntu11:~# echo > /etc/hostname

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

root@ubuntu11:~# 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 :

root@ubuntu11:~# /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 :

root@ehowstuff:~# hostname
Leave a Reply

Your email address will not be published. Required fields are marked *

A world leading hosting company that provides fully-managed innovative and secure solutions, suitable for hosting small to medium-sized websites

Built on the best available technologies combined with Google Cloud for strong redundancy and application availability. Backed by skilled experts to address web security threats, a devops team to create advanced custom security solutions, and 24/7 sysadmins to watch over the platform. This powerful, hands-on approach makes your sites faster, safer, and easier to manage. Starting from only $3.95/mo.


* up to 30 days money back guarantee