Easily manage the hosts file using the .net command-line tool
$ dotnet add package ppech.dotnet.hostsctlhostsctlhostsctl is a command-line tool for managing your system's hosts file. It provides commands for:
With the ability to use a template file to save entries within your project.
With options you can specify:
list list the entries in the hosts filebackup backups the hosts filerestore restores the hosts file from a backupadd <hostname> adds entry to the hosts fileremove <hostname> removes entry from hosts fileenable <hostname> enables entry in hosts filedisable <hostname> disables entry in hosts fileexists <hostname> checks if entry exists in hosts fileopen opens hosts file (using shell execute) - Windows onlytemplate
new creates a new template filelist list the entries in the template fileadd <hostname> adds entry to the template fileremove <hostname> removes entry from template fileapply applies the template file to the hosts file-i|--input <file>: path of input file, default value depends on operating system-o|--output <file>: path of output file, default value is same as input file-t|--template <template>: path of template file, default value is hosts.ht in working directory-j|--json: output as JSON<hostname>: host name, ex. app.mydomain.local[ip]: ip address, default is 127.0.0.1You can install it using the dotnet tool install ppech.dotnet.hostsctl --global command.
To update dotnet.hostsctl to the latest version, use the dotnet tool update command.
This project is licensed under the MIT License.