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.

To apply the changes, restart the hostname, and log out and log in again.

sudo service hostname restart

No comments:

Post a Comment