Aug 12, 2011

On Solaris, what is a terse way to get the fully qualified domain name (fqdn) for the current host


When I want the fully qualified domain name on Linux, I can write …

hostname --fqdn

To get the same thing on Solaris, is it necessary to write …

cut -f 2-3 /etc/hosts | grep ^`hostname`t | cut -f 2

… or is there something more brief?


From here:

The hostname command should return an FQDN…

The solution is to edit /etc/nodename and put the FQDN in there and reboot.

    echo > /etc/nodename

You might also be able to use:

getent hosts `hostname` | cut -f 3

or similar.

Related posts:

  1. What is the difference between a hostname and a fully qualified domain name?
  2. Bash prompt on Ubuntu – FQDN (H) same as hostname (h)
  3. mod_unique_id: unable to find IPv4 address of FQDN despite setting etc/hosts and Apache ServerName
  4. How do I fully qualify my domain name?
  5. Apache: Automatic log splitting per Virtual Host?

Leave a comment