Raspberry Pi

How to Change Raspberry Pi Hostname

The presence of multiple devices with similar names is inconvenient when it comes to getting things done. You must have different device names for your Raspberry Pi in order to use it for multiple purposes, such as serving as a web server or accessing it from a remote server. The main issue with the Raspberry Pi operating system is that it comes with the name “Raspberry Pi” by default, so you must rename them to differentiate between multiple devices.

Different methods are used to change the name of the Raspberry Pi hostname and it’s in your hand which method you like to select. This article will guide you to decide which methods you will use to change the name of your Raspberry Pi. If you want to change the name of your Raspberry Pi, all you have to do is carefully complete each step mentioned in the following section:

How to change Raspberry Pi name

There are several methods for changing the name of the Raspberry Pi, but here are the three most common. They are chosen to save Raspberry Pi users’ time and allow them to do whatever they want after the process is completed. The methods for changing the name of the Raspberry Pi are given below.

1. Changing Raspberry Pi name through terminal 

The terminal is a key component of the Raspberry Pi operating system. It will carry out any task you give it with a single command. So, if you really wish to change the name of your Raspberry Pi, then doing it through the terminal is a good option. If you want to replace the default name of your Raspberry Pi, simply enter commands mentioned in each in the terminal of your Raspberry Pi.

Step 1: The first step for you to do is to launch the Raspberry Pi configuration by entering the command as shown below.

$ sudo raspi-config

Step 2: Next, you will see the “System Options” when you enter the configuration setting, so select the option by pressing the enter button.

Step 3: After entering the “System Options”, select the third  option “Hostname” and press enter.

Step 4: Select “Ok” with the next option which appears on your screen and it will move you towards the name changing option. There you will see your hostname as “raspberrypi”.

Step 5: Replace the hostname “raspberrypi” with the name of your choice. In our case we choose “raspberrypi1” as shown in the image below.

After changing, press OK and Esc two times to go back to the terminal.

Step 6: Now in order to make changes to the user name, you need to enter “reboot” in the terminal of your Raspberry Pi. When the system reboots, you will see your Raspberry Pi hostname is changed from “raspberry pi” to “raspberrypi1”. and you can verify it by opening the terminal of your Raspberry Pi as shown in the image below.

2. Changing Raspberry Pi name from Desktop Mode

You can also change the Raspberry Pi default name through desktop as well. For that purpose, find the “Preferences” option in the main Raspberry Pi menu. Now, go to Raspberry Pi configuration and change the Hostname from “raspberry1” to “raspberry2”:

After clicking the “OK” option and then rebooting the system, you will see the hostname of your “raspberry1” is changed into “raspberry2” which can be confirmed from the terminal.

3.  Changing Raspberry Pi name through editing config files

You can also change the Raspberry Pi name through directly editing the config file. For that purpose, you have to put the below mentioned command in the terminal to change the hostname of the operating system from “raspberrypi2” to “raspberrypi3”.

$ sudo nano /etc/hostname

After changing, press the “Ctrl+X” to save changes to the system. It will save the changes, which are made to your system.

Step 3: After saving the modification press the “Enter” button to move back to the terminal option and enter “reboot” to reboot the system. After the reboot, you will see the name of the hostname is changed to “raspberry3” by opening the terminal.


Changing the default username of an operating system isn’t a difficult task, and Raspberry Pi users will do it quickly. If you are having difficulty changing the name of your Raspberry Pi, you should use any of the above methods. These methods can change your Raspberry Pi name and you don’t have to install any package on the terminal.

About the author

Awais Khan

I'm an Engineer and an academic researcher by profession. My interest for Raspberry Pi, embedded systems and blogging has brought me here to share my knowledge with others.