How to change your hostname in Ubuntu without restarting

  • Replace your old hostname in the /etc/hostname file with the new one: “sudo vi /etc/hostname”
  • Replace your old hostname beside the 127.0.0.1 in the /etc/hosts file
  • Run the following “sudo service hostname start”
  • Exit the terminal and open a new one, you’ll find the new hostname applied

Source: http://www.subvs.co.uk/ubuntu_change_hostname_computer_name

 

Unknown's avatar

About Ahmed Tawfik

Cybersecurity Professional, Systems Engineer, OSS & Linux Geek
This entry was posted in Uncategorized and tagged , , . Bookmark the permalink.

1 Response to How to change your hostname in Ubuntu without restarting

  1. scorpio2k2's avatar scorpio2k2 says:

    Or just use this command after you changed the name in /etc/hostname

    hostname -F /etc/hostname and the hostname will be changed

    Like

Leave a comment