Master da Web
Back to Blog

Changing the Hostname in Linux

LucasMarch 22, 20171 min readUpdated on November 4, 2023
  • 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.

Share

Need Hosting or Servers?

Discover our VPS, dedicated servers and professional hosting solutions

Related Articles

View all articles