Skip to main content
added 17 characters in body
Source Link
Anthon
  • 81.4k
  • 42
  • 174
  • 228

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)

getent hosts (backtick) /usr/bin/hostname (backtick) OR getent hosts $(/usr/bin/hostname)or

getent hosts $(/usr/bin/hostname)

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

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

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/etc/hosts. if you lookup for the host info for another host that is not in /etc/hosts/etc/hosts, it will look in DNS provided that is what is defined in /etc/nsswitch.conf

Good luck

Blaise/etc/nsswitch.conf

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) OR getent hosts $(/usr/bin/hostname)

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 lookup for 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

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)

or

getent hosts $(/usr/bin/hostname)

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 lookup for 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

added 39 characters in body
Source Link

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) OR getent hosts $(/usr/bin/hostname)

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 looklookup for 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

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

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) OR getent hosts $(/usr/bin/hostname)

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 lookup for 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

Source Link

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