September 2002
Beginner to intermediate
216 pages
7h 43m
English
If you are using Mac OS X 10.1.5 (or an earlier version of Mac OS X),
you’ll need to use NetInfo to maintain the hosts
database. The niload utility understands the
flat file format used by /etc/hosts
(ip_address:name). See the
hosts(5)
manpage for a description of each field.
To add a new
host, create
a file using that format and load it with
niload. This example uses a here document
instead of a separate file to add the host
xyzzy:
# niload hosts . <<EOF ? 192.168.0.1 xyzzy ? EOF
If you add an entry that already exists, it will not be changed or overwritten. Instead, niload will silently ignore your command. (To override this behavior, see the -m option under “niload” in Section 3.6, earlier in this chapter.)