天天看点

How to Change Hostname in Ubuntu 13.10

1. First make a backup of the following files.

cp /etc/hosts /etc/hosts.back
cp /etc/hostname /etc/hostname.back      

2. Edit the ‘hosts’ file:

vi /etc/hosts      

The file should look like this:

127.0.0.1 localhost
127.0.1.1 your_new_hostname      

Here, change “some_hostname” to the new hostname / computer name.

3. Edit the hostname file:

vi  /etc/hostname      

This file only contains your hostname so change it again to the new_hostname

4. Now restart the hostname and networking services:

service networking restart      

it could be that you will disconnected for a wail. after this re-login and check your new hostname with:

hostname -f      

- See more at: http://www.unixmen.com/change-hostname-ubuntu-13-10/#sthash.EYB6bzAf.dpuf