How to change hostname in Linux

In order to change the hostname of your linux machine, you can do the following:

1) Edit file /etc/sysconfig/network using your favourite editor, say using vi.

[root@mycomp]# vi /etc/sysconfig/network

2) Look for the line with HOSTNAME in it and change the entry to the desired hostname

3) Save the file and restart xinetd service

[root@mycomp]# /sbin/service xinetd restart

That’s it! You have just changed your hostname in Linux platform

You may also like...

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.