≡ Menu

Linux Change Hostname

  • Yeah March 16, 2013, 7:01 am

    None of this does anything to change the prompt which still reads: [root@localhost /] in CentOS6. After years of Linux mods, why is it still so damn complicated to change a single prompt ?!

    • Kimmo March 18, 2013, 7:45 am

      Sure it does, but you have to re-connect ssh to get it visible

  • smudger March 31, 2013, 4:34 pm

    For my debian-based xubuntu

    after editing /etc/hostname with sudo

    >> cd /etc/init.d
    >> sudo start hostname

  • vishnu May 23, 2013, 3:31 pm

    *In Fedora Simply follow this:

    # whereis hostname

    output: hostname: /bin/hostname /usr/bin/hostname /etc/hostname /usr/share/man/man1/hostname.1.gz /usr/share/man/man5/hostname.5.gz

    *edit
    vi /etc/hostname

    • noname001 August 22, 2013, 12:18 pm

      well you do not vi hostname file you pipe stuff there

      echo “hostname_1” >/etc/hostsname
      just to be clear

  • Pablosky January 29, 2014, 8:49 pm

    Thank you for help on how to find the file. It was crazy for me because it wasn’t hostname “xP

  • sabarimurugan S March 24, 2014, 5:07 pm

    I configure my rpm& yum server but the following error occurs please anyone tell me how to rectify the error

    file:///var/ftp/pup/repo/Server/repodata/repomd.xml: [Errno 5] OSError: [Errno 2] No such file or directory: ‘/var/ftp/pup/repo/Server/repodata/repomd.xml’
    Trying other mirror.
    Error: Cannot retrieve repository metadata (repomd.xml) for repository: Server. Please verify its path and try again

  • Logash July 16, 2014, 5:24 am

    How do i check which version of linux am running in and bit version?

    • mathews October 8, 2014, 3:35 pm

      cat /proc/version – provides the bit information
      cat /etc/issue – Release

      The above Commands should help.

  • Sly November 19, 2014, 11:17 am

    you can also use :
    “sudo /bin/hostname” to view the hostname and “sudo /bin/hostname NEWNAME” to change the hostname to NEWNAME.

    • Sly November 19, 2014, 11:18 am

      the command i wrote is for Ubuntu

  • Mark November 25, 2014, 6:03 pm

    On RHEL/Centos 7 I have had to use hostnamectl set-hostname

    All other ways had failed but this one worked great

  • K Thangamariappan November 26, 2014, 10:55 am

    For open SuSE/SLES 10

    /etc/hostname instead of /etc/HOSTNAME

  • pravinbhai s.Vaghmarya May 25, 2016, 9:16 am

    Address of hostname

  • pravinbhai s.Vaghmarya May 25, 2016, 9:17 am

    Change hostname addres

  • Security: Are you a robot or human?

    Leave a Comment

    You can use these HTML tags and attributes: <strong> <em> <pre> <code> <a href="" title="">