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

cjc
  • 24,916
  • 3
  • 51
  • 70
vikas
  • 13
  • 1
  • 3

3 Answers3

0

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

MDMarra
  • 100,734
  • 32
  • 197
  • 329
0

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

Bart De Vos
  • 17,911
  • 6
  • 63
  • 82
0

Try this

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