UbuntuUsing Google to research some really simple things sometimes gets really hard.  Take for example the hostname modification that I needed.  My lapse of how to accomplish this made me resort to the king of search, Google.  One thing I found was that there were way too many message board results that Google returns – and many with not really a close result that I was searching for.  So let me quickly describe for all the simple way that I found for changing the hostname.
First a couple of things.

Make sure you back up the files we will be changing.  I Linux every (or most) mistakes are easy to fix, so this step you might find not important.

sudo cp /etc/hosts /etc/hosts.bak && sudo cp /etc/hostname /etc/hostname.bak 

With backups made you can now edit the files:

sudo nano /etc/hosts

You should see something like this:
127.0.0.1 localhost
127.0.1.1 old hostname <- this is your prior hostname.

The next file to edit:

sudo nano /etc/hostname

Now reboot.
If everything went well you should have a working system with new names displayed.
Check to see if the hostname is resolved by typing:
sudo hostname

Well that’s it for the hostname.

Share

Leave a Reply

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

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>