hosts(1) - hosts database manager
A command line tool for managing the hosts database on UNIX systems. Requires bash >= 4.2
.
Synopsis
Often it makes sense when developing a web application to use the host name for development so you create a host file mapping to point the domain name to the local loopback address:
127.0.0.1 example.com
Then you put the application live so you comment out the entry:
#127.0.0.1 example.com
But you still need to switch between the local development version and the live version regularly which is when editing the hosts file manually becomes tedious.
Enter the hosts(1)
tool which lets you manage the host file as a set of blocks which can be easily switched on or off.
Documentation
The man page for hosts(1)
is available via the command hosts help
or you can view the online version if you prefer.
Directory Layout
By default the blocks and other files are stored in $hosts_storage
with this directory layout:
hosts
├── backup
│ └── hosts
├── history
│ └── hosts.1
├── loopback
│ └── hosts
├── blocks
└── example.on
Developers
Verify you have bash >= 4.2
using bash --version
. If you have an older version, you should update.
Ensure you have md5(1) and curl(1), clone the repository and install the strike(7) dependency by running npm install
.
Tests
Use the bake
symlink to run the test suite:
./bake test
You must have an active internet connection for all tests to pass as some tests query the database.