Skip to main content

No project description provided

Project description

hostsed is a simple python tool for editing hosts file(default /etc/hosts), you can add or delete a DNS entry via command line shell(e.x. bash). Editing hosts file with hostsed would be a more idemponent command line experience, i.e., add/del the same record won’t result duplicated or missing entries in the hosts file. hostsed will check the validity ip address for both IPV4 and IPV6.


You may install hostsed via pip. Python3 is preferred:

sudo pip3 install hostsed

Or on system default pip command:

sudo pip install hostsed


Display the hosts file content

sudo hostsed
# specify a location other than /etc/hosts
hostsed --file hosts.example

Add an entry

sudo hostsed add <ip address> <hostname1> <hostname2> ...


sudo hostsed add gateway
sudo hostsed add mongo-store-1 mysql-02
hostsed --file hosts.exmaple add

Delete an entry

rm/delete/remove are all alias for del:

sudo hostsed del <ip address> <hostname>


sudo hostsed remove gateway
hostsed --file rm ::1 localhost

Get the ip address of a docker container

sudo hostsed docker <docker-container-name>


Thanks for @noahfx provide some awesome improve for hostsed.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for hostsed, version 0.3.0
Filename, size File type Python version Upload date Hashes
Filename, size hostsed-0.3.0-py2.py3-none-any.whl (5.0 kB) File type Wheel Python version 3.7 Upload date Hashes View hashes
Filename, size hostsed-0.3.0.tar.gz (3.7 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page