Skip to main content

The hostname command is used to display the system's DNS name, and to display or set its hostname or NIS (Network Information Services) domain name.

# To show the current host name:
hostname

# To show the network address of the host name:
hostname -i

# To show all network addresses of the host:
hostname -I

# To show the FQDN (Fully Qualified Domain Name):
hostname --fqdn

# To set the current host name:
hostname <new_hostname>