Rename your R-Pi in 3 easy steps

Once you get to the point where you are running multiple r-Pis on your network, you will need to rename them so you can identify them on the wire. This is a very simple task that takes under 2 minutes to perform.

Log into the pi in question with SSH and type in:

sudo nano /etc/hostname

In the file that this will open you will see a single line which is the current hostname of your Raspberry Pi. Change it to whatever you want it to be (avoid special characters) and then press control-o (letter O) – enter to confirm the file, and then control-x to exit nano. Now back at the command prompt, type this command:

sudo nano /etc/hosts

In this file you will see a number of lines – the one you want starts with 127.0.0.1 and ends with the old name – leave the IP alone, and repeat the name you input above. Once done, you can again use control-o to output the file, and control-x to exit nano.

Last thing to do is reboot with:

sudo reboot now

That is it, you are all done and your pi will reboot with the new name!