HFM
Simple, programmatic
hosts
file manager. Just likenrm
.
Install
npm install hfm -g
Usage
If you use OS X or Linux, this module assumes your hosts file is at /etc/hosts
. On
Windows, it assumes your hosts file is at C:/Windows/System32/drivers/etc/hosts
.
help
Print help message for hfm
$ hfm help Usage: hfm [options] [command] Options: -V, --version output the version number -h, --help output usage information Commands: list|ls List origin or local host files alias show Show all current domain records in hosts file alias <name> <path> Alias a origin/local host file del <name> Unalias a origin/local host file set <ip> <domain...> Set a domain in the hosts file remove <domain...> Remove a set of host entries from URL or local path search <domain> Search related domain records in hosts file use <alias> Use a origin hosts path or an ALIAS_NAME unuse <alias> Unuse a origin hosts path or an ALIAS_NAME help Print help
list|ls
List origin or local host files alias
$ ./bin/cli.js ls* Google https://raw.githubusercontent.com/googlehosts/hosts/master/hosts-files/hosts* GoogleMirror https://coding.net/u/scaffrey/p/hosts/git/raw/master/hosts-files/hosts
show
Show all current domain records in hosts file
$ hfm show# ---------------------------- # SYSTEM 127.0.0.1 localhost255.255.255.255 broadcasthost
set [ip] [domain]
Set a domain in the hosts file
remove [domain]
Remove a set of host entries from URL or local path
alias [name] [path]
Alias a(n) origin/local host file
path
could be local path or URL
del [name]
Unalias a(n) origin/local host file
search [domain]
Search related domain records in hosts file
$ hfm search \.com$$ hfm search google.*$ hfm search www.google.com
use [alias]
Use a(n) origin hosts path or an ALIAS_NAME(see
hfm ls
)
$ hfm use Google
unuse [alias]
Unuse a(n) origin hosts path or an ALIAS_NAME(see
hfm ls
)