Changing the Hostname in Linux

shape
shape
shape
shape
shape
shape
shape
shape
  • Edit the “/etc/hostname” file, change the current hostname to the desired hostname.
vim /etc/hostname
  • Edit the “/etc/hosts” file, replace the old hostname with the new one.
vim /etc/hosts
  • Then run the following command:
/etc/init.d/hostname.sh start

That’s it!

To view the current hostname, use the “hostname” command.

Leave a Reply

Your email address will not be published. Required fields are marked *

Latest news

Latest news directly from our blog.