Site icon Ananova Business Web Hosting

Linux change Hostname

A person has selected a host name which was forced to him at the time of installation then, later on, he will definitely think of changing it. It happens many times when a person is forced to select a hostname because of non-availability of his required name. This creates dissatisfaction many times for most of the people because of unavailability factor. Later after using that not so wished name again & again, he wants to change it. Now the problem arises how to do this.

Ways to change Hostname

There is a need to alter host name many times. Changing hostname in Linux operating system via hostname command line is quite easy. It is convenient but temporary one. It will come to its original form when the system restarts. It is because with command line host name changes in system only & not registered on the server. That is the reason because of which hostname is not permanent & need to set every time.

Difference between Hostname & Domain name

The host name is entirely different from a domain name. The hostname is set at the kernel & it maintains the current hostname. The domain name is determined by the resolver system ordinarily from the host’s database or through DNS.

Change Hostname Permanently

Linux system works on the various operating system. Few of them are like Debian-based Linux system, RedHat based Linux system, etc. As Linux operates on a different operating system so the way to change hostname in those operating system. To change & save hostname in a Debian based is quite easy & simple. An individual just needs to open file /etc/hostname to read the hostname of the system.

He needs to do it at the time of rebooting and then he needs to set it up using the init script /etc/init.d/ server. Therefore, on a Debian-based Linux system an individual can edit the file /etc/hostname and change the name of the system and after giving required name, an individual needs to run /etc/init.d/, start to activate the changes. The hostname saved in the file /etc/hostname. Saving hostname permanently doesn't mean that if a person wants to change it in future, then he cannot change it; he can.

Hostname change on RedHat based Linux Systems

In RedHat based Linux system changing hostname is as trouble-free as in other Linux based systems. It uses the file /etc/sys config/network to read the saved hostname at starting of a system. This is also set using the init script similar to Debian system. it is /etc/rc.d/RC.sys init/etc/sys config/network. After this, an individual needs to fill necessary things required to fill. Therefore in order to preserve an individual's changed hostname on the system. He needs to reboot & edit this file and then he needs to enter the appropriate name using the hostname variable.

Myth about changing Hostname

Changing hostname is very simple & is a myth that in a Linux-based operating system it cannot be changed. There are many other Linux-based operating systems accessible. These are Slackware, Ubuntu etc. & in these systems also it is possible to reset hostname in as simple way as it is in other systems discussed.


To change the hostname of a Linux-based system, it is necessary to change it on the main server. Otherwise, an individual needs to change it every time.

Exit mobile version