Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/dunderrrrrr/hostf

Manage /etc/hosts with Python3 faster than lightning :zap: :sparkles:
https://github.com/dunderrrrrr/hostf

etchosts hostf hostname hosts hostsfile python python3

Last synced: about 1 month ago
JSON representation

Manage /etc/hosts with Python3 faster than lightning :zap: :sparkles:

Awesome Lists containing this project

README

        

![hostf](/img/hostf.png?raw=true)

Sometimes you need to manage your hosts file `/etc/hosts`.
Some do it on a daily basis.

This Python script will do it for you faster than lightning :zap: :sparkles:

## Installing
Clone and cd into dir.
```sh
$ git clone [email protected]:dunderrrrrr/hostf.git && cd hostf/
```

Add to `~/.bashrc`.
```shell
alias hostf='sudo /usr/bin/python3 /home/user/path/hostf/hostf.py'
```

Reload shell or restart terminal.
```
$ source ~/.bashrc
```

## Usage
### Add / delete / show records
```sh
$ hostf -a 10.1.1.50 example.com
```
```sh
$ hostf -d 10.1.1.50
```
```sh
$ hostf
127.0.0.1 localhost
10.1.1.5 test-serv
10.10.1.7 example.com
```

## Help
```sh
$ hostf -h
usage:
[ADD] hostf -a
[DEL] hostf -d

hostf will manage /etc/hosts faster than lightning.

optional arguments:
-h, --help show this help message and exit
-a 10.1.1.5 test.com Add to hosts.
-d 10.1.1.5 Delete from hosts.
```