First, you'll need to log into your Pi and edit the /etc/hosts file and add the desired hostname.
sudo nano /etc/hosts
You'll see a line like this:
raspberrypi with your desired hostname, save, and quit.
As an example, I'll set the hostname to
howchoo1. So my
/etc/hosts file would contain:
sudo nano /etc/hostname
By default, this file contains only the name
raspberrypi. Again, replace this with your desired hostname. Updating this file will ensure that the hostname remains set upon the next reboot.
For my example I would replace
If you'd like to reach the Pi by its hostname, you'll want to edit /etc/hosts on your local machine (not the Pi) and append the following:
<pi ip address> <hostname>
If necessary, learn how to find the IP address of your Raspberry Pi.
Now you can reach your Pi using the new hostname.
For our example, my entry would look like this: