Changing your Raspberry Pi network name

Changing the name of your Pi is a pretty straightforward task.

There are just two files that need to be changed to do this.

First, edit the file /etc/hostname. You can do this by opening a Terminal window and typing the following command:

$ sudo nano /etc/hostname

Replace “raspberrypi” with a name of your choice. This should be one word, with no punctuation or unusual characters (including the _ character.)

Now open the file /etc/hosts in an editor using the command

$ sudo nano /etc/hosts

The file will look something like this:

127.0.0.1 localhost
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
127.0.1.1 raspberrypi

Replace the text at the end that uses the existing name (“raspberrypi”) to the new name that you desire to be used.
Restart the Raspberry Pi, and you should see that the name has changed when you view it on the network from another computer or using an IP scanner