Up to $140 off-Lowest  Prices of 2024(Nov.21-Dec.2)

My Computer Tips

Home | About | Categories | All Tips & Tutorials

Change the hostname on Ubuntu server

ID: 374

Category: Linux Terminal

Added: 22nd of March 2024

Views: 659

To check your current hostname enter the following in the terminal

hostname

Enter the following command to open the hostname file in nano. If you are not logged in as a root user, you will need to add sudo and enter your root password.
sudo nano /etc/hostname

Delete the current hostname and set your new name,
Press CTRL + O , then press enter to save the file
Press CTRL + X to exit nano

Next you need to reboot your machine to confirm the changes
sudo shutdown -r now

Next time your login your new hostname will be applied.

Here is an example below