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:

[codesyntax lang=”bash”]

$ sudo nano /etc/hostname

[/codesyntax]

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

[codesyntax lang=”bash”]

$ sudo nano /etc/hosts

[/codesyntax]

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

Related posts

Overclocking a Raspberry Pi 4

Raspberry Pi: Get information about the RAM

Operating system images for the Raspberry Pi

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Read More