How to change the Ubuntu hostname easily.

Posted: October 3, 2016. At: 10:05 AM. This was 1 year ago. Post ID: 9772
Page permalink: http://securitronlinux.com/debian-testing/how-to-change-the-ubuntu-hostname-easily/

Now, we must convince Congress to stop the FCC. Can you display an alert?

To change the hostname of an Ubuntu machine, there are a couple of files that need editing. Firstly, open the /etc/hostname file and change the hostname in here to the one you wish to use.

09:51:17 0 ~
jason$ sudo vim /etc/hostname

Then edit the /etc/hosts file and change the hostname in there to match.

09:51:17 0 ~
jason$ sudo vim /etc/hosts

Now run this command to set the new hostname until you restart.

09:51:17 0 ~
jason$ sudo hostname darkstar

You do not need to reboot to set a new hostname, this is the proper way to do it, Linux is not as reliant upon re-boots as Windows.

Now I open another terminal and query the hostname and I see my new one there.

09:49:18 0 ~
jason$ hostname
darkstar

That is how easy it is to set a new hostname on Linux, this is very useful when customizing your Linux installation.

No comments have been made. Use this form to start the conversation :)

Leave a Reply