Change hostname of your Linux machine without Reboot

Change hostname of your Linux machine without Reboot :

You must fill hostname while installation. It is your machine name.

If you want a definition of host-name or you want to understand what exactly is it, you should click here .

But if you know about it, you should read ahead.

You must have seen your host name in terminal after symbol '@'.
But if you want to know your host-name using command line, you should run
# hostname
If you want to change it, follow this.

If you are using CentOS, Fedora or Redhat

1) Open file /etc/sysconfig/network
2) Now change HOSTNAME=old-host-name to HOSTNAME=new-host-name
3) Save the file
4) Restart network using
# service network restart
Now open terminal, you will see the host name has been changed after symbol '@'
If you are not satisfied enough. Run command
# hostname

If you are using Debian or Ubuntu

1) Open file /etc/hostname
2) Change the old hostname into new hostname.
3) Save the file.
OR
Run the following command
# echo new-hostname > /etc/hostname
Now open terminal, you will see the host name has been changed after symbol '@'
If you are not satisfied enough. Run command
# hostname

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...