Change hostname in Ubuntu

In Ubuntu,Hostname is used to either set or display the current host or domain
name of the system.Ubuntu defines hostname in file /etc/hostname and script /etc/init.d/hostname will read this file to set a hostname when startup,so we change change Ubuntu hostname by editing file /etc/hostname

1.Open a terminal window by pressing CTL+ALT+t

2.Use your favorite text editor to open /etc/hostname ,eg:

sudo gedit /etc/hostname

Note:Your need the administrator privilege to change your Ubuntu’s hostname

3.Input your password if prompted

4.After the file been opened ,it will show you your old hosname,just change it to your new hostname then SAVE this file

5.You can reboot to enable your new hostname or use below command to enable it without restart

sudo hostname mynewhostname

6.All done,you just changed your hostname of Ubuntu

2 thoughts on “Change hostname in Ubuntu

  1. Pingback: Change hostname in Ubuntu

  2. Gypsy

    Does not work I am trying to change home user name example
    when I hover over my pictures folder and or other folders
    it has my daughters name EX : home/lily/pictures

    I want to change it to my name how do I do this ? Please send step by step instructions, thanks. Explain it to me as if I were a kindergartner.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *