You can Watch all our Tutorials and Training Videos on our YouTube Channel for Free! Subscribe Now! & Free Web Tools available on

How to Change Hostname in Ubuntu Easily

linux ubuntu commands, change hostname on ubuntu, how to change hostname, change hostname using hostnamectl commands, hostname change in hosts file
This post will show you How to change hostname in Ubuntu Easily.

How to change hostname in Ubuntu Easily

Are you looking for changing the hostname in Ubuntu server. So here is the solution to change hostname in ubuntu server.

We need to make a entries in two files as below.

1. vi /etc/hosts     hostname

Replace "hostname" with your server hostname and also "" with your domain name.

2. vi /etc/hostname

Replace the content with your hostname and domain name.

After doing the changes, run any of these command or reboot the server for the changes to take effect.

sudo service hostname restart
cat /etc/hostname > /proc/sys/kernel/hostname

Hope this post helped you to know How to change hostname in Ubuntu Easily.

Related Content on Linux might be useful to you to improve your Linux Skills.

Keep practicing and have fun. Leave your comments if any.

Support Us: Share with your friends and groups.

Stay connected with us on social networking sites, Thank you.

Post a Comment

Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.
Site is Blocked
Sorry! This site is not available in your country.