Hosts File

When looking up a domain name, the DNS request returns an IP address that the site is located at.

You can override which IP address a domain is mapped to by editing your hosts file temporarily.

To do this on OS X, open a Terminal session and run this command:

sudo nano /etc/hosts

Navigate to the bottom of the file with your keyboard, and add a new entry, in this syntax:

1.2.3.4 domain.com

Save your hosts file by pressing Control-O on your keyboard and then Enter.

You can exit the editor by pressing Control-X.

In some cases, your web browser caches DNS lookups for domains, so you will need to completely quit out of your browser and restart it for the changes to appear.


Navigation
QR Code
QR Code hosts_file (generated for current page)