How to Change Host Name in Ubuntu 16.04

You may want to change the default hostname in Ubuntu16.04 for various reasons. It is not a cumbersome task and can be accomplished with a few proper steps. You must make changes to the file. The first step is to go the terminal.

$ sudo gedit /etc/hosts.

Press enter and the command opens the etc/hosts files in the default text editor. This is termed as Gedit in the Ubuntu. Since this is a system -level file, it cannot be changed by the users. To make changes you must use a sudo. (Sudo is a program for the UNIX Operating system by which a user can run programs using the security privileges of the user administrator).

You must login to your account. You will find localhost and dell-laptop-3344. Change the latter to some other name. Make changes in the file name that is linked to your IP address. Save, close and restart the system.

How to change the HostName in Ubuntu 16.04 without restarting:

$ sudo hostname xxxx

to change your hostname to ‘xxxx’ promptly. xxxx here is an example. You may choose any name you want. Do the changes in the same way in the /etc/hosts file. Done. You have successfully changed your hostname. The /etc/hosts will show the new name that you created whenever you login next.

Have questions?

Ask us.

    AWS Standard Consulting Partner

    • Go4hosting
    • Go4hosting

    Alibaba Cloud


    Go4hosting-NOW-NASSCOM-Member Drupal Reseller Hosting Partner

    Cyfuture Ltd.

    The Cricket Barn
    EX16 8ND

    Ph:   1-888-795-2770
    E-mail:   [email protected]