Solaris equivalent of hostname -f

fqdnsolaris

What is the Solaris equivalent of the Linux hostname -f command? On Solaris, when I type hostname, I receive the short name but I need to get the FQDN.

Typing hostname -f sets the short name to be "-f", and the manpage for hostname is pitiful.

Best Answer

This is likely to work:

perl -mNet::Domain -e 'print Net::Domain::hostfqdn(), "\n"'

but it's not guaranteed. You can view the module source:

perldoc -m Net::Domain

to see how it works (if you know Perl well enough).