1

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

3 Answers 3

0

Try this

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

The command hostname should return a FQDN assuming that it's configured correctly in /etc/nodename.

0

hostname should return this, if it doesn't, you probably set it up wrong.
Try combining it with domainname in that case.

1
  • This assumes he is using NIS and assumes his NIS domain name is the same as his DNS domain name.
    – Nicholas
    May 9, 2012 at 16:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.