Change device host name of your Raspberry Pi

The default hostname is “raspberrypi”,  we can change that to “raspberrygertrover” or any name that you like.
Step one is to edit the hosts file to ensure that the device knows when it should refer to itself. we can do this by using Nano any other text editor.

Enter the following :

sudo nano /etc/hosts

This file contains a list of all the system set dns to ip resolutions. What you will need to do is find the line that starts “127.0.1.1″, after this is the current name of the device, change this to the device name u want. So mine would look like :

127.0.1.1           raspigertrover

Save this file and then return back to the console.

Step two is to change the hostname:

sudo nano /etc/hostname

This file contains only the current hostname and should be replaced with your desired name, save and close this file.

Last step is to commit these changes to the system  by entering the following line :

sudo /etc/init.d/hostname.sh

Reboot and check the name change.

(Visited 2,461 times, 1 visits today)