Saturday, December 14, 2013

Changing computer name on Ubuntu

To change the computer name on Ubuntu, you need to do the following :

First, you need to edit /etc/hostname file. To do this, run the following command :

sudo vim /etc/hostname


Change the name as required. After that save and exit ( Use :x to save and exit).

Now, you need to edit /etc/hosts file. To do this, run the following command :

sudo vim /etc/hosts


In the file, you might see something like :

127.0.0.1       localhost

127.0.1.1       "your computer name"

Change the text next to 127.0.1.1 to the name you like. Save and exit.

The changes will be applied when you restart the system. To apply changes without restarting, use the following command :

sudo service hostname restart

This is how the /etc/hosts file would look :

No comments:

Post a Comment