2

The hostname of my name is very long, which is odd. How can change the hostname for my system?

My hostname, currently, is

himanshu@himanshu-Lenovo-ideapad-100-15IBD:~$

Is there any way I can shorten this or change it entirely?

muru
  • 207,228

1 Answers1

7

Open Terminal (Alt+Ctrl+T), and enter this:

sudo -H gedit /etc/hostname

Enter your password, and then a file will open. Just change the name to the new hostname, and save the file. Do the same with the hosts file, by running:

sudo -H gedit /etc/hosts

Edit the name to your new hostname after 127.0.0.1 and save.

Restart your computer, and it should be done.

Edit: Use gksudo instead of sudo. It's safer.

Kartik Shah
  • 355
  • 1
  • 9