Change the “device name” in System settings in Ubuntu

Do you want to change your device name as shown in System settings (as shown in the screenshot below) ?

Alright, we will change our device name with the all powerful sed commmand. For your information sed is a special editor for modifying files automatically. If you want to write a program to make changes in a file, sed is the tool to use. For more information on how to use sed refer to

http://www.grymoire.com/Unix/Sed.html#uh-0 .

Solution:

Run the following in your terminal:

sudo sed -i 's/present-host-name/new-host-name/' /etc/hosts
sudo sed -i 's/present-host-name/new-host-name/' /etc/hostname

Now check your present-host-name by cat /etc/hostname or hostname .

EnJoY! 😀

namechange

Advertisements