hostinfo(1)
| HOSTINFO(1) | User Commands | HOSTINFO(1) |
NAME
hostinfo - utility for looking up hostnames and IP addresses.
SYNOPSIS
hostinfo [-a] [-n] [-l] [-1] [-{x|o|d}] [-{X|O|D|N}] [-p] <host> [<host>...]
DESCRIPTION
Find and print name, IP address(es), and aliases (if any) of each specified host. By default, first try to interpret <host> as a numeric dotted-quad IPv4 address. If <host> doesn't appear to be a numeric IP address, assume it is a hostname to look up. The -N option forces <host> to be interpreted as a hostname.
Host information comes from the gethostbyname(3) and/or gethostbyaddr(3) function calls. These function calls use some combination of both the "hosts database" (usually, '/etc/hosts' and/or NIS/NIS+), 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).
If none of -a, -n, or -l are given, host information prints out in a well-labelled, human-readable format. For example:
- address: 127.0.0.1
- hostname: localhost
- aliases: localhost.localdomain
If you use one or more of the -a, -n, or -l options, host information prints in a more compact format, with requested fields separated by tab characters. For example:
- 127.0.0.1
- localhost localhost.localdomain
Note that some hostnames map to multiple IP addresses. By default, hostinfo prints a separate record for each address. Use the -1 option to cause only the first address to be printed.
The -p option causes hostinfo to interpret each host as an IP address, skip the lookup stage, and print 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
- Print only the IP address(es) of each host.
- -n, --name
- Print only the name of each host.
- -l, --aliases
- Print only the aliases, if any, for each host.
- -1, --first-address
- If a host has multiple IP addresses, only display the first one.
- -x, --print-hexadecimal
- Print IP addresses in hexadecimal (base 16).
- -o, --print-octal
- Print IP addresses in octal (base 8).
- -d, --print-decimal
- Print IP addresses in decimal (base 10). This is the default.
- -X, --expect-hexadecimal
- Try to interpret <host> as a hexadecimal (base 16) IP address, in the format 'wwxxyyzz' (e.g., 7f000001).
- -O, --expect-octal
- Try to interpret <host> as an octal (base 8) IP address, in the format '\qqq\rrr\sss\ttt' (e.g., \177\000\000\001).
- -D, --expect-decimal
- Try to interpret <host> as a decimal (base 10) IP address, in the normal dotted-quad format 'nnn.mmm.ppp.rrr' (e.g., 127.0.0.1). This is the default.
- -N, --force-name
- Don't try to interpret <host> as an IP address; assume each specified host is a hostname.
- -p, --print
- Don't try to look up <host>; if it's a valid IP address, print it in the requested format (decimal [default], hexadecimal, or octal).
- -h, --help
- Display this builtin usage information.
- -V, --version
- Display program version, copyright, and warranty information.
AUTHOR
Written by Jim Knoble <jmknoble@jmknoble.cx>
COPYRIGHT
Copyright © 1998,1999,2000 Jim Knoble
THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the author(s) be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software.
Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation.
| December 2020 | hostinfo version 2.2 (2000-Jul-20) |
