Change Linux Hostname with hostname Command



Configuration for GNU Linux Fedora Computer using Linux Command

 

   The hostname command can be use to change host name on Linux machine.  The step by step command example below show the use of the hostname command to change Linux hostname.  The host name that change by the hostname command is not going to be permanent, the hostname is for temporary basis... the new hostname will be reset back to the original host name before we change the hostname... after the Linux machine rebooted.  To change hostname permanently... see this article on how to change Linux hostname permanently.

hostname Command Example:

# hostname 

# hostname [new hostname]

 

1.  Display current Linux hostname.

display linux hostname

[root@fedora ~]# hostname

fedora.linux.com

[root@fedora ~]#

 

2.  Change current Linux host name (fedora.linux.com) to new hostname new.hostname.com 

change linux hostname

[root@fedora ~]# hostname new.hostname.com

[root@fedora ~]# 

 

3.  Verify the hostname changes by execute the hostname command again

display hostname

[root@fedora ~]# hostname

new.hostname.com

[root@fedora ~]# 

 




0 comments: