An ultimate hosts file utility.
- This project is currently in its early stage, please backup your hosts file before using this tool.
- Please download executable binaries for your architecture from here.
$ hostsconfig -h
hostsconfig [OPTIONS]
The OPTIONS are:
-l, --list List hosts file on standard output
-b, --beautify Display beautified hosts file on standard output
-a=, --add= Add a host entry
-d=, --delete= Delete a host entry
-s, --save Save changes
-f=, --path= Path to hosts file (Default: /etc/hosts)
-h, --help Show this usage help
-v, --version Display version
- To list well-formatted hosts file:
hostsconfig -l
- To see a human readable, and beautified hosts file:
hostsconfig -b
- To use a different hosts file, (by default uses
/etc/hosts
):
hostsconfig --path="/tmp/hosts_copy"
- Adding new hosts:
hostsconfig -l -a="127.0.0.1 example1.com"
hostsconfig -l -a="192.168.0.3 example2.com example2.local"
hostsconfig -b -a="ff02::1 foo-ipv6.com"
- Delete existing hosts:
hostsconfig -l -d="127.0.0.1 example1.com"
hostsconfig -l -d="127.0.0.1 example1.com my-site.com foo.com"
hostsconfig -l -d="192.255.255.255"
hostsconfig -l -d="::ff02::3"
hostsconfig -l -d="example2.com bar.com"
- Saving changes:
sudo hostsconfig -b -a="ff02::1 foo-ipv6.com" -s
sudo hostsconfig -l -s -d="example2.com bar.com"
- Parse & validate hosts file
- Preview hosts file in standard format, as well as in human understandable beautified format
- Provision add/delete entry in hosts file
- Allow saving modified, well-formatted changes in-place in hosts file
- Provision editing an existing entry
- Add unit tests to make it production ready
- Ship working cross-platform (Unix, Windows) executable
- And other features described here
go build
env GOOS=darwin GOARCH=386 go build -o hostsconfig-darwin
env GOOS=linux GOARCH=arm GOARM=7 go build -o hostsconfig-linux
- Please RTFM here.
Copyright (c) 2015, Vishal Telangre. All Rights Reserved.
This project is licenced under the MIT License.