Hostname Vs Domain Name Linux. You can use hostnamehostnamectl command to show or set the systems host name and dnsdomainname command to show the systems DNS domain name. Domainname nisdomainname ypdomainname will print the name of the system as returned by the getdomainname 2 function.
A hostname is a name that is given to a computer that attached to the network that uniquely identifies over a network and thus allows it to be accessed without using its IP address. Dnsdomainname will print the domain part of the FQDN Fully Qualified Domain Name. The Fqdn You cant change the FQDN as returned by hostname --fqdn or the DNS domain name as returned by dnsdomainname with this command.
Host name can be get with different ways in Linux.
Ssh ip-address or ssh hostname. So we can simple print the host name to the terminal with echo command like below. You can display your machine hostname by typing hostname in your console. The Fqdn You cant change the FQDN as returned by hostname --fqdn or the DNS domain name as returned by dnsdomainname with this command.