mkhosts Command

Purpose

Generates the host table file.

Syntax

/usr/sbin/mkhosts [ -v ] HostFile

Description

The mkhosts command can be used to generate a hashed host database, using the filename specified by the HostFile parameter. It is not used if name resolution is performed by the named daemon. The host file is usually the /etc/hosts file, and in any case must be in the same format as the /etc/hosts file.

The mkhosts command generates database files named hostfile.pag and hostfile.dir. Updates to these files are built in a set of temporary files named hostfile.new.pag and hostfile.new.dir. The temporary files are copied into the database files only if the hostfile.new.pag and hostfile.new.dir files are built without errors.

The host file is used by one version of the gethostbyaddr and gethostbyname library routines for name resolution.

Note: The version of the gethostbyaddr and gethostbyname library routines on this operating system do not support the hostfile.pag and hostfile.dir files.

After creating the host file, you can edit it to include the desired host entries.

Flags

Item Description
-v Lists each host as it is added to the host file specified by the HostFile parameter.

Examples

Use the following command to generate the /etc/hosts.pag and /etc/hosts.dir files:

mkhosts /etc/hosts

This command creates two host files called /etc/hosts.pag and /etc/hosts.dir.

Files

Item Description
hostfile.pag One of two files containing the real database for name resolution.
hostfile.dir One of two files containing the real database for name resolution.
hostfile.new.pag One of two files containing the temporary database for name resolution.
hostfile.new.dir One of two files containing the temporary database for name resolution.