How To Change Your Linux Hostname

How To Change Your Linux Hostname
How To Change Your Linux Hostname

You may want to change the name of your Linux box system from time to time. This should work on most, if not all Linux distributions.

Gain root access either through the sudo command or frontend of sudo, (e.g kdesudo, gksudo). You will need to run a text editor (console or desktop based).

Edit /etc/hostname and replace it with a new hostname. Save the file.

Run "hostname -F /etc/hostname" (without quotes) to change the hostname (this command may vary depending on the distribution you are using).

Restart your computer if you do not see the effect, it will not be changed immediately in bash shells.


Do not stay logged in as root for long durations.

When editing system files with root, you must be careful. One wrong thing could put your system in danger!

Help Us Grow

If you like this post, please share it with your friends.

You are free to copy and redistribute this article in any medium or format, as long as you keep the links in the articles or provide a link back to this page.

Subscribe to our mailing list

You may also like...