How to change hostname in Linux Mint

To change the hostname in Linux Mint, you can follow these steps:

  1. Open a terminal window. You can do this by pressing Ctrl+Alt+T.
  2. In the terminal, type the following command and press Enter to open the hostname configuration file in a text editor:
   sudo nano /etc/hostname
  1. In the text editor, you will see the current hostname. Delete the existing hostname and enter the new hostname you want to set.
  2. Press Ctrl+O to save the changes, and then press Ctrl+X to exit the text editor.
  3. Next, you need to update the hosts file. Type the following command in the terminal and press Enter to open the hosts file in a text editor:
   sudo nano /etc/hosts
  1. In the text editor, you will see a line containing the old hostname followed by “localhost.” Replace the old hostname with the new hostname you set in the previous step.
  2. Press Ctrl+O to save the changes, and then press Ctrl+X to exit the text editor.
  3. Finally, you need to restart the system or restart the networking service for the changes to take effect. To restart the networking service, type the following command and press Enter:
   sudo service networking restart

Alternatively, you can reboot the system by typing the following command and pressing Enter:

   sudo reboot

After the system restarts, the new hostname will be applied. You can verify the new hostname by opening a terminal and typing the following command:

hostname

It should display the new hostname you set.

All the best nerd!

Leave a Reply