A tool to manage hosts file
Project description
# hostsman
Add, remove or list mappings in hosts file
INSTALLATION
Package Link: hostsman
You can use pip to install this tool.
Run pip install hostsman.
USAGE
$ Help
Run hostsman or hostsman -h to check the help doc:
(pypi) ➜ hosts git:(master) ✗ hostsman
usage: hostsman [-h] [-l | -c HOSTNAME [HOSTNAME ...] | -i HOSTNAME[:IP]
[HOSTNAME[:IP] ...] | -r HOSTNAME [HOSTNAME ...]]
Add, remove or list mappings in hosts file
optional arguments:
-h, --help show this help message and exit
-l, --list Show the content of hosts file
-c HOSTNAME [HOSTNAME ...], --check HOSTNAME [HOSTNAME ...]
Check if the host name existed in the host file
-i HOSTNAME[:IP] [HOSTNAME[:IP] ...], --insert HOSTNAME[:IP] [HOSTNAME[:IP] ...]
Insert HOSTNAME[:IP] mappings
-r HOSTNAME [HOSTNAME ...], --remove HOSTNAME [HOSTNAME ...]
Remove mapping for HOSTNAME from hosts file.
hosts file location: /etc/hosts
The last line of help gives the hosts file location on your pc.
$ List mappings in hosts file
Run ``hostsman -l`` to list out the content of hosts file.
127.0.0.1 localhost 255.255.255.255 broadcasthost ::1 localhost fe80::1%lo0 localhost 127.0.0.1 my.local
$ Check HOSTNAME
Check if a hostname is configured in hosts file.
Run hostsman -c hostname,
It will return the result if hostname is in hosts file:
# Search result: 127.0.0.1 localhost ::1 localhost fe80::1%lo0 localhost
Check multiple hostnames
Run hostsman -c my.local my.local2,
It will print out the mappings for given hostnames
# Search result: 127.0.0.1 my.local 127.0.0.1 my.local2
$ Insert mappings
Add single mapping
Run hostsman -i my.local3:192.1.1.3, it will insert new mapping:
192.1.1.3 my.local3
If not given ip, the default value 127.0.0.1 will be used:
Run hostsman -i my.local4, it will insert mapping:
127.0.0.1 my.local4
Add multiple mappings.
Run hostsman -r my.local my.local2:192.1.1.3
$ Remove mapping
Run hostsman -r my.local to remove my.local
A backup file will be created for every removal operation(when the hostname is existed)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Hashes for hostsman-1.0.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ef527c5b9e6e27379229f1f507d73e58dbf056b1a6b965eadbb3d498023664e7 |
|
MD5 | 3d4987d16521cebc345567125e2c80ce |
|
BLAKE2b-256 | df89539ca5bb1214e7e944892ae487b285bd0b5128839a9470eb03c0fcecbcd0 |