sudo nano /etc/hostname
sudo nano /etc/hosts

With above I couldn't change the name, because there is an error showing :

read only permission

at the bottom of the window


You can use sudoedit (see man sudoedit) to edit those files as,

sudoedit /etc/hostname
sudoedit /etc/hosts

They're protected against casual modification.

  • It's nice support it workout..thanks..but after reboot hostname was same as old..It did not change permanently. Pls let me know how to change the hostname permanently. ..thanks again.. – Migara Feb 1 '17 at 10:57
  • I'm working on kernel GNU/Linux 4.4.0-47-generic 1606 – Migara Feb 1 '17 at 11:09

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.