To change the hostname in Linux Mint, you can follow these steps:
- Open a terminal window. You can do this by pressing Ctrl+Alt+T.
- In the terminal, type the following command and press Enter to open the hostname configuration file in a text editor:
sudo nano /etc/hostname
- In the text editor, you will see the current hostname. Delete the existing hostname and enter the new hostname you want to set.
- Press Ctrl+O to save the changes, and then press Ctrl+X to exit the text editor.
- 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
- 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.
- Press Ctrl+O to save the changes, and then press Ctrl+X to exit the text editor.
- 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!