By default the Raspberry Pi has its hostname set to “raspberrypi”. This appears as part of the command prompt when you open a terminal window. You can change it by editing a few system files. This process only takes a minute.
Open a terminal window from your program list. For example “LXTerminal” under “Accessories”.
sudo leafpad /etc/hostname
followed by ENTER. Type the hostname you require and using the menu save the file and exit.
Then type :
sudo leafpad /etc/hosts
followed by ENTER. Replace all instances of “raspberrypi” with the new hostname that you entered above.
Then you can either reboot by typing :
followed by ENTER or simply restart the hostname process by typing :
sudo /etc/init.d/hostname.sh start
followed by ENTER.
The hostname as been changed. You new hostname will now be visible in the command prompt when you open a new terminal window.
Please ensure you choose a hostname that only contains upper and lower case letters, numbers and the “-” character.
In the steps above we used Leafpad to edit the two system files. An alternative editor is available called Nano. To try this editor use the two commands below to edit the files :
sudo nano /etc/hostname
sudo nano /etc/hosts
The advantage with using Nano is that it can be run from the command line and does not require a graphical interface. This makes it a better choice if you are accessing your Pi remotely using Putty or similar utility.