hostinfo

display name, IP address, and aliases of host 

Command


SYNOPSIS

hostinfo [-a] [-n] [-l] [-1] [-x|-o|-d] [-X|-O|-D|-N] [-p] host [host...]

hostinfo --help

hostinfo --version


DESCRIPTION

The hostinfo utility finds and displays the name, IP addresses, and aliases (if any) of each specified host. By default, hostinfo first tries to interpret host as a numeric dotted-quad IPv4 address. If host> doesn't appear to be a numeric IP address, hostinfo assumes it is a host name to look up.

Host information comes from the gethostbyname() or gethostbyaddr() function calls. These function calls use some combination of both the "hosts database", and, if available, the system's DNS resolver. What combination and in what order is configured in an operating-system dependent manner (and is outside the scope of this program).

When none of -a, -n, or -l are specified, hostinfo displays host information in a well-labelled, human-readable format. For example:

 address: 127.0.0.1
hostname: localhost
 aliases: localhost.localdomain

When you specify one or more of the -a, -n, or -l options, hostinfo displays the host information in a more compact format, with requested fields separated by tab characters. For example:

127.0.0.1     localhost       localhost.localdomain

Some host names map to multiple IP addresses. By default, hostinfo displays a separate record for each address. Use the -1 option to display only the first address.

When -p is specified, hostinfo interprets each host as an IP address, skips the lookup stage, and displays the address in the requested format. Together with the -x/-o/-d and -X/-O/-D options, this turns hostinfo into a quick tool for converting between IP address formats.

Options

-a 
--address 

displays only the IP addresses for each host.

-D 
--expect-decimal 

tries interpret host as a decimal (base 16) IP address, in the normal dotted-quad format nnn.mmm.ppp.qqq (for example, 127.0.0.1). This is the default.

-d 
--print-decimal 

displays IP addresses in decimal (base 10). This is the default.

-h 
--help 

displays the built-in usage information.

-l 
--aliases 

displays only the aliases (if any) for each host.

-N 
--force-name 

forces host to be interpreted as a host name.

-n 
--name 

displays only the name of each host.

-O 
--expect-octal 

tries interpret host as a octal (base 18) IP address, in the format \qqq\rrr\sss\qqq (for example, \177\000\000\001).

-o 
--print-octal 

displays IP addresses in octal(base 8).

-p 
--print 

does not attempt to look up host. If host is a valid IP address, hostinfo displays it in the requested format (decimal [default], hexadecimal, or octal)

-V 
--version 

displays program version, copyright and warranty information.

-X 
--expect-hexadecimal 

tries to interpret host as a hexadecimal (base 16) IP address, in the format wwxxyyzz (for example, 7f000001).

-x 
--print-hexadecimal 

displays IP addresses in hexadecimal (base 16).

-1 
--first-address 

displays only the first IP address when a host has multiple IP addresses. If a host has only one IP address, that address is displayed.


DIAGNOSTICS

Possible exit status values are:

0 

Successful completion.

>0 

An error occurred.


PORTABILITY

All UNIX systems.


AVAILABILITY

PTC MKS Toolkit for System Administrators
PTC MKS Toolkit for Developers
PTC MKS Toolkit for Interoperability
PTC MKS Toolkit for Professional Developers
PTC MKS Toolkit for Professional Developers 64-Bit Edition
PTC MKS Toolkit for Enterprise Developers
PTC MKS Toolkit for Enterprise Developers 64-Bit Edition


PTC MKS Toolkit 10.4 Documentation Build 39.