A zsh plugin for quickly switch hostfile and refresh dns cache
- Download this plugin and place it in
path-to-zsh/custom/plugin
- Activate the plugin by adding
host-switch
inplugins
in your config file
-
Setup hostfiles
-
Be advised, before setting up this plugin, remember to backup your original file
/etc/hosts
as you might already add a few custom host setting into you hosts file. This plugin works as a tiny tool to help you switch between several hosts files. -
Add host file to be switched in
hostfile
folder, and rename the file likehosts.dev
. Switching current hosts file tohosts.dev
reqires this command. Filename extension was used as the arguments to match files.
hostswitch dev
- Use
hoststatus
to check which host script is being used currently. - Changes might take effect in several minutes so you might need to reset your DNS cache.
-