How can I rename my computer? Renaming it in /etc/hosts and /etc/hostname does something weird. Before renaming it, I am able to open these files via sublime using

sudo subl /etc/hosts

but when I rename my Computer (using nano) and open any of these files using subl, I get this message:

No protocol specified

(sublime_text:20071): Gtk-WARNING **: cannot open display: :0.0

So I guess renaming in the above files is not the only thing I have to do.

PS: If I rename using sublime, after renaming one of the files, I get same message when I try to open other file


This sounds like a problem in Sublime Text. You need to change the hostname using:

sudo hostname your-new-name

Then you need to add the new hostname to your /etc/hosts file with this command:

sudo nano /etc/hosts

Find these lines and change the original name to your new hostname:       localhost       your-new-name

To save in nano Ctrl+O.
To exit from nano Ctrl+X.

Restart the computer or all services that use the old name.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.