Hostman is a command line manager for /etc/hosts
.
cargo install hostman
Download the latest release for your architecture from github and put it in a directory in your path.
You can use the trust install script to install this tool:
curl -LSfs https://japaric.github.io/trust/install.sh | \
sh -s -- --git lucascaro/hostman
Run the tool to get a usage summary:
hostman
Use this command to show your current hosts file.
Use this command to check if a host is in your hosts file:
$ hostman check localhost
# localhost is used to configure the loopback interface
127.0.0.1 localhost
::1 localhost
Add a new host to your hosts file.
hostman add <ip> <names> [comment]...
Add a new host to your hosts file, using 127.0.0.1 as the ip.
hostman local <names> [comment]...
Remove a host from your hosts file.
hostman remove <host>
Disable (comment out) a host from your hosts file.
hostman disable <host>
Enable a commented out host from your hosts file.
hostman enable <host>
Update the cli to the latest version.
hostman update