Change the hostname easily on your Ubuntu or Linux Mint machine
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.