How to change the hostname on a running Linux system


Method 1::

If you are new to linux you probably will ask how to change the hostname of you computer. (A hostname is the unique name by which a network attached device is known on a network.) If you enter the wrong hostname during the installation, and you need to change the hostname, here is the solution:-
* Edit file /etc/sysconfig/network using your favourite editor. In my case is vi. So I’ll enter vi /etc/sysconfig/network

Code:
/etc/sysconfig/network
NETWORKING=yes
HOSTNAME="xxxxxxx"
GATEWAY="192.168.0.1"
GATEWAYDEV="eth0"
FORWARD_IPV4="yes"
HTML Code:
* Look for HOSTNAME=xxxxxx
* Change the xxxx to the name you wish to set for your computer. (ex: HOSTNAME=cliffsupport.com)
* Save the file and restart the xinetd service. (ex: type service xinetd restart in your shell)
* Done! You have just changed your hostname in Linux platform
Method 2::
On any Linux system you can change its hostname with the command ‘hostname‘ Here are some quick usages of the command line hostname:
shell#hostname

without any parameter it will output the current hostname of the system.

shell#hostname --fqd

PHP Code:
it will output the fully qualified domain name (or FQDNof the system
shell#hostname NEW_NAME

: