Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question

3 Answers 3

up vote 0 down vote accepted

Try this

echo `uname -n`.`awk '/^domain/ {print $2}' /etc/resolv.conf`
share|improve this answer
    
this worked, thanks –  vikas May 9 '12 at 15:59

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

share|improve this answer

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

share|improve this answer
    
This assumes he is using NIS and assumes his NIS domain name is the same as his DNS domain name. –  Nicholas May 9 '12 at 16:53

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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