1. add-etc-hosts(8)
  2. add-etc-hosts(8)

NAME

add-etc-hosts - add/remove an hostname to/from /etc/hosts

SYNOPSIS

add-etc-hosts [ -6 ] [ hostname ]
rm-etc-hosts [ -6 ] [ hostname ]

DESCRIPTION

This manual page documents briefly the add-etc-hosts and the rm-etc-hosts commands.

add-etc-hosts is a script that enables a local "bogus" hostname to be used on the loopback interface for development purposes. While developing sites locally it's convenient to refer to the sites through an handle so that they can easily be reached. The way to do that is by editing the /etc/hosts file and adding the desired hostname to the line relative to 127.0.0.1. This script automates that process.

If the -6 optional argument is specified then it adds the hostname also to the IPv6 loopback ::1.

Likewise, rm-etc-hosts disables a hostname by removing the hostname from /etc/hosts.

If the hostname exists already in /etc/hosts then trying to add it again has no effect.

If the hostname doesn't exist in /etc/hosts then trying to remove it has no effect.

EXAMPLES

Enable a site (IPv4 only):

add-etc-hosts my.local.wp.site

Disable a site (IPv4 only):

rm-etc-hosts static.host-local

Enable a site (IPv4 and IPv6):

add-etc-hosts my.local.drupal.site

Disable a site (IPv4 and IPv6):

rm-etc-hosts -6 img.host-local

FILES

/etc/hosts
The hosts file. Where local addresses are mapped to hostnames.

SEE ALSO

nginx_ensite(8), nginx_dissite(8), a2ensite(8), a2dissite(8), nginx(1)

add-etc-hosts is Copyright (C) 2011 Antonio P. P. Almeida <appa@perusio.net> under the terms of a MIT license.

AVAILABILITY

The latest version of add-etc-hosts is available from: https://github.com/perusio/add-etc-hosts.

AUTHOR

add-etc-hosts was written by Antonio P. P. Almeida <appa@perusio.net> that also wrote the manual page.

  1. January 2012
  2. add-etc-hosts(8)