What Is the /etc/hosts File in Linux?

The /etc/hosts file is a plain text file used in matching a fully qualified domain name (FQDN) with the server IP hosting a specific domain.

/etc/hosts File

1 minute
image_pdfimage_print

Comments don’t require any standard format provided the hash character precedes the comment entry. You can have multiple comments, but every line must start with a hash character.

Introducing the Pure Storage Platform for the new era of data services

An Example of the /etc/hosts File in Linux

You might already have entries in your /etc/hosts file, but you can add more using a simple text editor. You can also remove entries, but remember that the DNS server must be available to reach the domain from a web browser.

The following is an example of a Linux /etc/hosts file:

Written By: