Change the Raspberry Pi’s Hostname

1. Edit the /etc/hosts file

sudo nano /etc/hosts localhost 
::1 localhost ip6-localhost ip6-loopback 
fe00::0 ip6-localnet 
ff00::0 ip6-mcastprefix 
ff02::1 ip6-allnodes 
ff02::2 ip6-allrouters raspberrypi

2. Change last line to the new hostname raspi

3. Also edit and change the hostname file

sudo nano /etc/hostname

4. Commit the changes

sudo /etc/init.d/
sudo reboot

You also can change the hostname using raspi-config

sudo raspi-config

Or using Adafruit Pi Finder

sudo nano /boot/[hostname].txt

Raspberry Pi, Arduino and other embedded systems to learn and create