How to change current host name in Linux?

 


Host name is simply your computer's name that is usually set upon installation of Linux distribution. Maybe for some reason, you want to change that name. If that is so, in this article I'm going to show you how?


Determine current host name!

Due to fact that modern Linux distributions uses Systemd, there is a tool or command known as hostnamectl. Once run in terminal it will show the current host name of your machine. Here's the command.

# hostnamectl 


As we can see, the name of my machine is 'ubuntustation' and I want to change this name into 'bhl'. Here's the command that will accomplish such task. 

Change current host name

The command that will change the current host name is the following.

# hostnamectl  set-hostname bhl

Once executed, the host name should be changed from 'ubuntustation' into 'bhl'. If we run the hostnamectl command once more, we should seen a new host name of the machine. 


There we go. The host name has been successfully changed from 'ubuntustation' into 'bhl'. I hopped that you have successfully changed your own host name as well.

Conclusion

Hostnamectl is a very simple command that allows you to change your current host name into new name of your machine. In case that you need to change name which you have set upon installation process, now you know how to change it. If you like this article, make sure to share it, like it, comment it down bellow and till the next time. 

Share:

Nema komentara:

Objavi komentar

POPULARNI POSTOVI

NAJNOVIJE