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 127.0.0.1 localhost and 127.0.0.1 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.