Here is a simple command you can use to change the hostname in Ubuntu.
how to
sudo hostnamectl set-hostname new_hostname
Read below to find out what is hostname and another way to change it in Ubuntu-server
By definition, hostname is a name that is assigned to a “host” here host means a computer on a network. So it basically means the name of your computer. This hostname is used for identification of your computer on the network
By default, it is set up when you install Ubuntu or any Linux on your system. The name that you type at the time of installation is used with hardware model number as a hostname. To know what’s the hostname of your system type below command in terminal.
hostnamectl
Now you can see whats current hostname of your system in terminal in static hostname section.
See when you were installing Ubuntu you thought naming Tom will be great, but now you are thinking NO Jerry is better. There can be various reasons due to which you might want to change your system’s hostname. But just don’t use the same name for two computers on the same network as it might create problems. Although whatever the reason to change hostname here is a simple method to do so.
It’s quite easy to change the hostname in Ubuntu Linux. Just open Terminal either by searching or by pressing Ctrl + Alt + T keys together. Type below commands and you are done.
hostnamectl set-hostname new_hostname
Here replace new_hostname with whatever you would like to keep. You can verify by entering hostnamectl command in terminal.
But this method doesn’t seem to work on Ubuntu-Server so if you are using Ubuntu-server follow the method below.
Type the following commands in terminal:
sudo hostname new_server_name
Next, edit the /ect/hostname file and update hostname:
sudo nano /etc/hostname
Finally, edit the /etc/hosts file and update the lines that read your old-host-name:
sudo nano /etc/hosts
From: 127.0.1.1 Old_hostname to 127.0.1.1 new_hostname
Save and close the file and its done.
If you are facing any problems please do let us know in comments. Any other problem you are facing on your computer and want to fix it do let us know in comments we would try to help you as much as we can.
Do you want to know how to screenshot on Snapchat without them knowing? here is how you can do it.
You can utilize a wide range of tools as a Linux user to keep organized, manage your time, and become… Read More
Have you ever caught yourself in a situation where you need details of an audio/ video media file? When you… Read More
If you have installed Linux alongside windows in the dual boot you might have noticed that every time you boot… Read More
Linux kernel is like the core of the operating system. It's a piece of software that works as a middle… Read More
Nowadays, most Linux Distros already have Python preinstalled. But you might have a distribution that might not have Python preinstalled.… Read More
Python is one of the most popular and easy to learn programming languages. Its a widely used high-level programming language… Read More
Just so that you know we use cookies on our website. Want to know more
read here