Facebook Twitter Instagram Pinterest YouTube
    Trending
    • Add Kodi to RetroPie Menu
    • Disable Auto-login in Raspberry Pi OS
    • Raspberry Pi Cloud Storage with MEGA
    • RetroPie Temperature Monitor from Menu
    • Pi Pico Pinout and Power Pins
    • Install Arduino IDE on Raspberry Pi
    • Raspberry Pi 400 SSD Upgrade
    • Raspberry Pi Temperature Monitoring
    Facebook Twitter Instagram Pinterest YouTube RSS
    Raspberry Pi SpyRaspberry Pi Spy
    • Home
    • Categories
      • General
      • Hardware
      • Programming
      • Python
      • Software
      • Tutorials & Help
    • BerryClip
      • BerryClip Instructions
      • BerryClip Plus Instructions
      • Videos & Reviews
    • Buy
      • Buy Pi
      • Buy Pi Accessories
      • Buy Books
    • Tools
      • Ultimate Raspberry Pi Alexa Skill
      • Pi Power Estimator App
      • Pi-Lite 14×9 LED Matrix Sprite Editor
      • RPiREF Pin-out Reference App
      • Simple Ohm’s Law Calculator
      • Web Sites & Links
    • Tutorials & Help
        Featured
        November 9, 20200

        Raspberry Pi Temperature Monitoring

        Recent
        May 6, 2022

        Add Kodi to RetroPie Menu

        February 26, 2022

        Disable Auto-login in Raspberry Pi OS

        February 2, 2022

        Raspberry Pi Cloud Storage with MEGA

      1. Contact Us
      2. Site Map
      Raspberry Pi SpyRaspberry Pi Spy
      You are at:Home»Software»Raspbian»How To Rename Your Raspberry Pi

      How To Rename Your Raspberry Pi

      2
      By Matt on November 13, 2012 Raspbian

      The Raspbian SD image gives your Raspberry Pi a default name of ‘raspberrypi’. This name appears in the command prompt. Many people will leave it at the default but you may wish to change it to something more unique.

      It’s quick and easy to change by following the steps below.

      Note: A hostname can only contain the letters ‘a’ through ‘z’, the digits ‘0’ through ‘9’, and the hyphen (‘-‘).

      Step 1 – Edit Hostname File

      The first thing to do is edit the /etc/hostname file. You can do this by entering the following command at the command prompt :

      sudo nano /etc/hostname

      This will lauch the hostname file in the Nano text editor. Change raspberrypi to the name of your choice. In the example below I changed it to mypi.

      Press CTRL-X, then Y and finally Enter to save the changes.

      You can type the following command to check the file contains the new name :

      cat /etc/hostname

      Step 2 – Edit Hosts File

      The next file that needs to be changed is the /etc/hosts file. We can use the same technique to edit this file.

      sudo nano /etc/hosts

      Using the cursor keys locate and update the line that says

      127.0.1.1    raspberry

      to

      127.0.1.1   mypi

      Here is a screenshot :

      Leave the other lines unchanged. Press CTRL-X, then Y and finally Enter to save the changes.

      You can type the following command to check the file contains the new name :

      cat /etc/hosts

      Step 3 – Reboot and Test

      All the changes are made but we must reboot for those changes to take effect. Use the following command to reboot the Pi :

      sudo reboot

      Once the Pi has rebooted your command prompt should now include the new name. You can also type hostname at the command prompt to get your Pi to report its name.

      Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
      Previous ArticleCheap Miniature LCD Screen
      Next Article Raspberry Pi Mounting Hole Template for Printing

      Related Posts

      Running Flask under NGINX on the Raspberry Pi

      Free Space on Your Raspberry Pi SD Card

      Analysing Storage Usage on a Raspberry Pi with Ncdu

      2 Comments

      1. Graham on November 15, 2012 11:08 pm

        Hi Matt

        May I suggest a few simplifications to this guide, the method I regularly use is the following:-


        sudo su
        echo mypi > /etc/hostname
        /etc/init.d/hostname.sh start
        reboot

        the setting of 127.0.1.1 in /etc/hosts is a bug workaround for gnome from as far back as 2005 – So I leave it well alone – other unix systems do not use this method. I’ve left my host name referring 127.0.1.1 to raspberrypi with no ill effects so far..

        Keep up the good work Matt.

        G.

        Reply
      2. Pingback: 5 Raspberry Pi Projects For Kids | Initial StateInitial State |

      Leave A Reply Cancel Reply

      This site uses Akismet to reduce spam. Learn how your comment data is processed.

      Recent Posts
      May 6, 2022

      Add Kodi to RetroPie Menu

      February 26, 2022

      Disable Auto-login in Raspberry Pi OS

      February 2, 2022

      Raspberry Pi Cloud Storage with MEGA

      January 7, 2022

      RetroPie Temperature Monitor from Menu

      January 24, 2021

      Pi Pico Pinout and Power Pins

      Categories
      • 1-wire
      • 3D Printing
      • Add-ons
      • BBC Micro:bit
      • BerryClip
      • Books
      • Camera Module
      • Cases
      • Events
      • General
      • Hardware
      • I2C
      • Infographics
      • Interfaces
      • Minecraft
      • Model A+
      • Model B+
      • News
      • Pi Models
      • Pi Zero
      • Power
      • Programming
      • Python
      • Raspberry Pi OS
      • Raspbian
      • RetroGaming
      • Robotics
      • Sensors
      • Software
      • SPI
      • Tutorials & Help
      Tags
      3D Printing Arduino audio battery berryclip Birthday bluetooth cambridge camera CamJam DigiMakers display games GPIO I2C interface Kickstarter LCD LED Linux media Minecraft Model A Model B motionEyeOS PCB photography photos Pi-Lite portable power python Raspberry Jam Raspberry Pi Bootcamp raspbian Retrogaming retroPie screen SD card security sensor SPI temperature ultrasonic video
      Raspberry PI Related
      • Adafruit Blog
      • Average Maker
      • Official RaspBerry Pi Site
      • Raspberry Pi Pod
      • RasPi.tv
      • RaspTut
      • Stuff About Code
      Tech Resources
      • MattsBits – Pi Resources
      • Microbit Spy
      • Technology Spy
      Archives
      About

      Unofficial site devoted to the Raspberry Pi credit card sized computer offering tutorials, guides, resources,scripts and downloads. We hope to help everyone get the most out of their Pi by providing clear, simple articles on configuring, programming and operating it.

      Popular Posts
      September 19, 2014

      Top 5 Reasons The Raspberry Pi Sucks

      July 27, 2012

      16×2 LCD Module Control Using Python

      October 20, 2013

      Analogue Sensors On The Raspberry Pi Using An MCP3008

      Recent Posts
      May 6, 2022

      Add Kodi to RetroPie Menu

      February 26, 2022

      Disable Auto-login in Raspberry Pi OS

      February 2, 2022

      Raspberry Pi Cloud Storage with MEGA

      Facebook Twitter Instagram Pinterest YouTube RSS

      Entries RSS | Comments RSS

      This site is not associated with the official Raspberrypi.org site or the Raspberry Pi Foundation. Raspberry Pi is a trademark of the Raspberry Pi Foundation.

      Copyright © 2022 - All Rights Reserved - Matt Hawkins

      Type above and press Enter to search. Press Esc to cancel.