For Linux newbies its not easy to remember complex file locations and commands, for example just for changing the hostname of PC have to edit two files under ‘/etc/’ directory.

I will demonstrate how to change hostname in Ubuntu 12.04 with the help of screenshots.


Step -1 Edit ‘/etc/hosts’ file using ‘gedit’ text editor, follow the below screenshot.

Use ‘sudo gedit /etc/hosts’ command and press Enter.


Specify your desired hostname same as below.




Step-2 Edit second file ‘/etc/hostname’.3


Step-3 Restart PC.

sudo init 6

If you are looking to change hostname without restart in Ubuntu 12.04 then Watch Video

Similar Posts