Category: Linux Terminal
Added: 22nd of March 2024
Viewed: 374 times
Change the hostname on Ubuntu server
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