Cart 0

SALE Now On! Up to 20% OFF across the store!

Renaming your Raspberry Pi - the 'hostname'

Operating System Raspberry Pi Raspbian

If, like me, you have more than one Raspberry Pi on your network, then it is a good idea to give each one a unique name.  If you use Raspbian, then that name is 'raspberrypi' by default.  It is really easy to change that name to (almost) whatever you like.  This name is known as the 'hostname'.

First, log onto your Pi and open a terminal window.  Your Pi's name is in a file called 'hostname' in the /etc directory.  Edit that file as superuser with:

sudo nano /etc/hostname

This file contains only one line - the name of your Pi.  Change the name to whatever you like, but only use the letters 'a' to 'z' (upper or lower), digits '0' to '9', and the dash '-'.

Save the file using Ctrl+x, then Y followed by Enter.

There is a second file that also contains the hostname, but it is only there as a workaround for some software.  Therefore you should also edit that file:

sudo nano /etc/hosts

Find the line starting with, and change the name following it to your new hostname.  Save the file using Ctrl+x, then Y followed by Enter.

Once you have rebooted your Pi, all other computers on your network should see it with the new hostname.  On the Pi itself, you can check your hostname by issuing the following command in a terminal window:


Older Post Newer Post