When connecting to the Raspberry PI you will see it on your phone with a default name of "PerfectPi". You can change this name to something that you would like. Actually, you should change the name to something else to learn how this name could be changed. With this tutorial, you will learn some pretty interesting hacks and a thing or two about file system
- 19 Feb 2018
Place the SD card in the computer, open the card with file explorer suitable for your operating system, locate the file /etc/hostname, open it and where you see the name "PerfectPi" or "raspberrypi" write the name that you want.
Mounting the SD Card when there is already an image on it.
There are different ways to mount and unmount the SD card depending on the operating system that you are using. We would do different tutorials for operating systems that are Windows, Linux, Mac OS.
Locating the file
After you mount the SD card you will see a new device shown in you computer explorer. This is "rootfs". You should open this device. And there is a folder called "etc" and in this folder, there is a file called "hostname".
Most of the time, we would refer to files using their full paths. The full path of a file is the name of all the folders in which this file is and the name of the file itself. In this case for a file called "hostname" located in "etc" the name of the file is:
Feel like a hacker?
This is getting pretty technical. Do you feel like a hacker :). Open the file /etc/hostname. Open it with a text editor for your operating system. For Windows, this would be Notepad.
Changing the value of the raspberry name in the file
In the file, there is a single line
Change this line to
Where "MyNewName" is the new name for your Raspberry Pi. Be creative. Find something useful.
Unmounting the SD Card
Don't forget to properly unmount (eject) the SD card before removing it from the computer. If you don't and if you just remove the SD card then the file will probably not be saved.
Courses and lessons with this Tutorial
This Tutorial is used in the following courses and lessons