Skip to main content
1 of 3

On Solaris this worked well for me: sorry for the backtick, it is the reversed quote next to number 1 on a qwerty keyboard or you can use $( command) in KSH

getent hosts (backtick) /usr/bin/hostname (backtick)

example: root@melauto:[/]# getent hosts $(/usr/bin/hostname)

10.4.19.241 melauto.sro.vic.gov.au melauto loghost root@melauto:[/]#

getent queries the current name search mechanism as specified in /etc/nsswitch.conf and returns the information that matches the search, here it returns the info as found in /etc/hosts. if you look the host info for another host that is not in /etc/hosts, it will look in DNS provided that is what is defined in /etc/nsswitch.conf

Good luck

Blaise