How to easily change localhost or hostname in Ubuntu Linux

Ubuntu Linux tools

In this sense, this article would be aimed at users of a specific operating system: Ubuntu Linux. How come? Despite being an operating system that doesn't have big figures in terms of the number of computers that use it, the community of Linux users continues to grow.

How to easily change localhost or hostname in Ubuntu Linux

Now, this operating system can be confusing for many people, mainly because it is a software that it works mainly through codes or commands.




That said, this will be a guide that will help you better understand the tools of this operating system and what you can do with them. Do you have the courage?

Customization of the operating system

One of the most notable features of this Linux distribution is the possibility it offers the user of be customized according to your tastes and needs. And this is something really important, because it goes far beyond the interface aspect.

What is localhost or hostname?

If you are not very familiar with the term, there is no time to waste. When provides identification to the computer or any other device, it is essential to know it.

Speaking of localhost or hostname means referring, in fact, to a method of identification of a computer, device or system that is connected to a network or to a WiFi access point.

Change the localhost or host name in Ubuntu

How to easily change localhost or hostname in Ubuntu Linux

There are several alternatives for change the local host name or host name via the Ubuntu Linux operating system and here each of them will be explained to you in the simplest way possible so that you can do this successfully.



Hostname command

The first alternative to change the localhost or host name via the distribution Linux OS Ubuntu is via the following command. Enter the terminal of your computer and respect the following instructions:


  • Enter the command: "hostnamectl status", this is used to know the current hostname information of your computer.
  • Using the command " hostnamectl set-hostname “, Enter the new host name, so that the computer identification can be changed.

Editing files

Another alternative to perform this action is through the edition of the files related to the host of the computer. You can make the change as follows:

  • Edit the configuration file named / etc / hosts /
  • Your initial data should have the following structure:
    • 127.0.0.1 localhost.localdomain localhost
    • 192.168.10.21 new host name
  • Then, edit the / etc / sysconfig / network file, which will display the following information:
    • NETWORK = yes
    • HOSTNAME = "enter the new host name"
    • GATEWAY = “192.168.10.21”
    • GATEWATDEV = “eth0”
    • FORWARD_IPV4 = "yes"

Configuration panel

One last recommended alternative for network assignment and configuration and a new host name for the computer is via the Hostinger panel.


Accessing is very simple, you just have to enter the menu “Server” which you will find in the navigation bar. Find the section for the host name and change its values ​​to establish a new identification on your computer.


Save your changes and that's it! The values ​​corresponding to the hostname of your computer will have been changed successfully and in an extremely simple and fast way.

Go ahead and try changing your computer's local host or hostname

With this set of quick and easy tools provided by the Ubuntu Linux operating system via its terminal, there isn't much else to do. It is about making the decision to make this kind of modification that, although it may seem pointless at first, it doesn't hurt to do so.


Now that you know how to change the localhost name or hostname in Ubuntu, not just the your computer will be able to be identified checking the number of devices connected to your network, but you will also have new knowledge that other people may not handle and be extremely sensitive to.

add a comment of How to easily change localhost or hostname in Ubuntu Linux
Comment sent successfully! We will review it in the next few hours.