How to change the hostname in Ubuntu ?

In this article you will learn how to modify the computer name ( hostname ) in ubuntu starting from 14.10 release.

It ‘s not complicated to change it since we will be editing the hostname files.First open up the terminal and run the following command in order to know your current hostname :

hostname

To modify it, edit the file /etc/hostname first using your preferred editor :

sudo gedit /etc/hostname

Delete the hostname displayed and insert any name you like (we chose mac ). Finally save your file and exit.

Now you edit the file /etc/hosts :

sudo gedit /etc/hosts

And change the name (we changed it from ubuntu to mac) to what you chose above . Save and exit.

Now you need to reboot your system. You can then check again your hostname :

It shows the name you chose above.

Leave a Reply

avatar
  Subscribe  
Notify of
Close Menu
Show Buttons
Hide Buttons