https://github.com/bartobri/hosts
Perl script to manage the local hosts file of a windows 10 machine
https://github.com/bartobri/hosts
hosts hostsfile manage
Last synced: about 1 year ago
JSON representation
Perl script to manage the local hosts file of a windows 10 machine
- Host: GitHub
- URL: https://github.com/bartobri/hosts
- Owner: bartobri
- License: gpl-3.0
- Created: 2018-04-20T13:27:35.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-08-01T21:56:13.000Z (almost 8 years ago)
- Last Synced: 2025-01-30T14:33:27.453Z (over 1 year ago)
- Topics: hosts, hostsfile, manage
- Language: Perl
- Size: 16.6 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
hosts
======
This is a basic perl script to help manage entries in a local hosts file. It was
built for me to easily add, remove, comment, and uncomment entries in the hosts
file of my Windows 10 machine. Hoever, it is easily adaptable for unix/linux systems.
#### Running on Windows 10
By default, it is set up to work on a Windows 10 platform from within the linux
subsystem. You will need to be comfortable installing and using the linux subsystem
to use this script in its default state.
#### Running on Unix/Linux
To run this on a unix/linux system, you will need to modify the $hosts_file and $newline
variables to match your system. Generally, these values would be "/etc/hosts" and "\n"
respectively.
#### Installing
Assuming that Windows users are using the linux subsystem, the installation instructions
are the same regardless of your platform.
```
$ git clone https://github.com/bartobri/hosts.git
$ cd ./hosts
$ sudo cp hosts /usr/local/bin/
```
#### Usage
hosts needs to be run as root, so always use sudo.
Dump the hosts file:
```
$ sudo hosts show
```
Add a new host entry
```
$ sudo hosts add newhost.com
```
Remove an existing host entry
```
$ sudo hosts rm newhost.com
```
Comment an existing hosts entry
```
$ sudo hosts stop newhost.com
```
Uncomment an existing hosts entry
```
$ sudo hosts start newhost.com
```