Add/Remove hostnames from the /etc/hosts file
This script was created for simplifying the addition/removal of
hostnames to the
/etc/hosts file. It's particularly useful if you're
developing a site locally and want that site to have a "handle" that
is related to the project name.
For example if I'm developing a site that is for a widget maker that will use the domain mywidgetmaker.com I'll do:
Now I can enter
http://mywidgetmaker.com.local on the address bar of the
browser and it will show me the site that I'm developing.
If I want to add an IPv6 hostname I specify the optional argument
add-etc-hosts -6 mywidgetmaker.local
Now there's an IPv6 loopback hostname. You can access your new IPv6 host.
Clone the git repo or download it.
Put the scripts in a directory included in your
PATHor define aliases like this:
alias add-etc-hosts='/path/to/add-etc-hosts' alias rm-etc-hosts='/path/to/rm-etc-hosts'
Source the new aliases, if you have them in a
or something similar, depending on the name and location of the file where the aliases are defined.
Install the manual pages
man/man8section of your local documentation directory.
Full documentation is on the manpage