Change hostname on Mint Linux / Ubuntu – Howto

To change your hostname, you’ll need to edit /etc/hostname file with

sudo nano /etc/hostname

The file content is very simple. It contains the current hostname and all you need to do is to replace it with the new one, save and exit

After you save the changes, open /etc/hosts file and replace the current hostname with the new one near 127.0.1.1 IP address.

Change

...
127.0.1.1 old-hostname
...

into

...
127.0.1.1 new-hostname
...

Save file and exit.

Now, enter the next command

sudo hostname new-hostname

Your computer’s hostname will be changed immediately. (The change won’t appear in the terminal until you reopen it again)

This method will work on all Debian based distros (Ubuntu, Kubuntu, ….)

Leave a Reply

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