Interview Questions

What is the /etc/hosts File?

Beginners Guide to Sockets


(Continued from previous question...)

What is the /etc/hosts File?

The correspondence between host names and IP addresses is maintained in a file called hosts in the (top-level) directory /etc. On most systems, any user can read this file. (A word of caution: on many systems, printing this file may be injurious to local paper supply!!)

Entries in this file look like the following:

127.0.0.1		localhost
192.217.44.208	snoopy beagle hound metlife
153.110.34.18	bugs wabbit wascal
153.110.34.19	elmer
153.110.34.20	sam

Note that more than one name may be associated with a given IP address. This file is used when converting from IP address to host name and vice versa.

(Continued on next question...)

Other Interview Questions