Unix – how to get hostname along with domain name

hostnamesolaris

In unix (solaris) is there any command where i can get hostname & domain name together??

ex. hostname -> servername domainname -> us.xyz.com

i need it output as : servername.us.xyz.com

Best Answer

Try this

echo `uname -n`.`awk '/^domain/ {print $2}' /etc/resolv.conf`