LogoLogo
Terminal
  • Attic Lab
  • Getting Started
  • Crest Gold
  • Crest Silver
  • Videos on Computation
  • PI PICO (CIRCUITPYTHON)
    • Getting Started
    • Pin Out Diagram
    • Breadboards
    • 1. Led Blink
    • 2. RGB
    • 3. OLED
    • 4. Sensors
    • 5. Wifi
    • 6. Servos
  • Arduino
    • Getting Started
    • Pin Out Diagrams
      • Mega2560 R3
    • Programming
      • Arduino C - Cheat Sheet
    • Buttons
      • Momentary Switches
    • Display
      • LEDs
      • 7 Segment Displays
      • LCD Displays (GPIO)
      • LCD Displays (SPI)
      • OLEDs
    • Communication
      • Antenna Theory
      • Lora
      • Wifi
        • Boards
    • Project Ideas
    • Motion
      • DC Motors
      • Servo Motors
      • Stepper Motors
  • Microsoft Office
    • Word
    • Powerpoint
    • Excel
  • The Terminal
    • Basics
    • Cheat Sheet
    • Games
      • Level 1 - Bashcrawl
      • Level 2 - Bandit
  • TinkerCad
    • Gallery
    • Getting Started
    • Basic Operations
    • Basic Skills
    • Projects
      • Locking Container
  • Python
    • Hello World
    • Turtle Graphics
      • Strings in Turtle Graphics
      • Cheat Sheet
    • Variables
    • Loops
    • If Statements
    • Functions
    • Games
      • Pong
  • Raspberry Pi
    • Setup
      • Changing The Hostname
      • Headless Setup
      • Kiosk Mode
    • Remote Connections
    • Displays
      • Memory
        • External HD
      • HyperPixel 4.0
  • Ultimaker 3D Printing
    • The Thingiverse
    • Preparing the File
    • Printing
    • Calibration Prints
    • Print Set
  • Fusion 360
    • Getting Started
    • Design Tutorials
      • Tweezers
      • Mars Rover Wheel
    • Surface Modeling
  • Electronics
    • References
    • Antenna Theory
    • LoRa
  • PCB Milling
    • FlatCam
    • Candle
    • PCB Milling
  • Projects
  • Projects
    • Star Map Necklace
    • Ideas Respository
  • Latex
    • What is LaTeX?
    • Getting Started
    • Structure
    • Page Size & Margins
    • Styling
    • Images
    • Lists
    • Tables
    • Mathematics
      • Superscript and Subscripts
      • List of Symbols
      • Fractions and Binomials
      • Integrals, Sums & Limits
    • Colors
  • Web Development
    • The Internet
    • Intro to HTML
    • Basic Elements
    • Basic Styling
Powered by GitBook
On this page
  • How to Change Your Raspberry Pi's Hostname
  • Change Raspberry Pi Hostname at Command Prompt
  • Change Raspberry Pi Hostname in Desktop Mode
  • Change Raspberry Pi Hostname by Editing Config Files

Was this helpful?

  1. Raspberry Pi
  2. Setup

Changing The Hostname

PreviousSetupNextHeadless Setup

Last updated 4 years ago

Was this helpful?

How to Change Your Raspberry Pi's Hostname

By May 01, 2020

Out of the box, every Raspberry Pi is listed as ‘raspberrypi.’ Change the Raspberry Pi hostname to rename your device.

Fortunately, it’s very easy to rename your Raspberry Pi in Raspbian.There are three main ways to change the Raspberry Pi’s hostname and, which one you choose, really depends on your preference for command line or desktop environment. Note that your Raspberry Pi hostname can have numbers, letters, capital letters and hyphens (as long as the first character isn’t a hyphen) but it can’t have special characters.

Change Raspberry Pi Hostname at Command Prompt

1. Launch raspi-config by typing:

sudo raspi-config

The Raspberry Pi Configuration tool launches. RECOMMENDED VIDEOS FOR YOU...CLOSEVolume 0% PLAY SOUND

2. Select Network Options.

3. Select Hostname and hit Enter or select Ok if you receive a warning telling you not to use special characters in Raspberry Pi’s hostname.

4. Enter a new hostname and hit Enter. 's Hardware)

5. Click Finish to exit raspi-config. You can get to the Finish button by hitting Tab.

6. Select Yes when asked if you’d like to reboot. If you select No then you’ll need to reboot manually for your change to take effect.

When your Raspberry Pi reboots, it should have the new hostname.

Change Raspberry Pi Hostname in Desktop Mode

There’s no need to go to a terminal window to rename your device. If you’re on the desktop, changing your Raspberry Pi’s hostname is just as easy.

1. Launch Raspberry Pi Configuration from the Preference menu.

2. Enter a new name in the hostname field and click Ok.

3. Click Yes when prompted to reboot.

Change Raspberry Pi Hostname by Editing Config Files

If you’re the kind of person who prefers to get their hands dirty going into text files and changing settings there, you can edit the relevant hosts files directly. The easiest way to get there is from the command line.

1. Open the /etc/hosts file for editing.

sudo nano /etc/hosts

2. Change the old Raspberry Pi hostname to your new one and save. In nano, you save by hitting CTRL+X and then Y for yes.

3. Open /etc/hostname for editing.

sudo nano /etc/hostname

4. Change the hostname there and save.

5. Reboot your Raspberry Pi for the changes to take effect. At the command prompt, you can type the following to reboot.

sudo reboot

By default, any that uses Raspbian, the official OS, has “raspberrypi” as its hostname. So, whether you’re trying to use your or that you access remotely, your board will always be listed as “raspberrypi” on your network. That’s not very helpful when you have multiple Raspberry Pi devices and can’t tell one from the other.

Raspberry Pi
Raspberry Pi as a web server
set up a headless Raspberry Pi
Avram Piltch
How to Change Your Raspberry Pi's HostnameTom's Hardware
Logo