How To Find Domain Name Linux. Hostname will print the name of the system as returned by the gethostname 2 function. To find the IP using the host command follow the steps given below 1.
Get Host name By Echoing Host name File. At the Unix shell prompt enter nslookup followed by the IP address for example. And then type the following command and press enter-host domain_name.
So we can simple print the host name to the terminal with echo command like below.
And then type the following command and press enter-host domain_name. Dig is a flexible cli tool for interrogating DNS name servers. Dnsdomainname will print the domain part of the FQDN Fully Qualified Domain Name. First of all check if your server is having domain name already set up or not using below command.