#hosts #block #ads #privacy

app block-list

A minimalist hosts-based tool for managing block lists and ad-blocking

6 stable releases

1.1.4 Jul 2, 2021
1.1.3 Jun 28, 2021
1.1.2 Jun 25, 2021
1.0.0 Jun 24, 2021

#365 in Text processing

24 downloads per month

GPL-3.0 license

51 lines


Block List

A minimalist hosts-based tool for managing block lists and ad-blocking.

This project uses the excellent and regularly updated Unified Hosts lists from Steven Black.

Why should you use Block List?

  • It is an extensible, small and simple tool; consisting of only fifty-five lines of code!
  • It will block this traffic across all programs running on the system.
  • It is written in Rust and hence can be depended upon to be fast and stable.
  • It is designed to be easily incorporated into shell scripts to automate or customize its behaviour to your liking.
  • A hosts-based block list such as this uses minimal system resources to block unwanted traffic in comparison to a browser extension.


Using Cargo (Rust)

cargo install block-list

More options will come in future!


Just use 'hosts' as the desired list if you only want ad-blocking.

sudo block-list /path/to/hosts your-desired-list


Basic usage:

sudo block-list /etc/hosts social

Pipe in a custom list:

cat someFile.txt | sudo block-list /etc/hosts


cat someFile.txt | sudo block-list /etc/hosts social

Automatically update Block List at 10pm:

Open the root user's crontab file

sudo crontab -e

Then add the following line

0 22 * * * block-list /etc/hosts hosts

Use Block List to re-route a url to a different address:

Find the address using dig

dig duckduckgo.com

Coppy the IP address listed in 'Answer Section' to a file

# A custom Block List

# Re-route all requests from Google to DuckDuckGo www.google.com google.com

Pipe in the custom list to Block List

cat someFile.txt | sudo block-list /etc/hosts


If successful, this command will append a new list or replace the current list at the tail of the supplied hosts file, eg:

Block List updated! 🔒
# Host Database
##	localhost	broadcasthost
::1             localhost

# Your list of addresses somehost


# Block List some.custom.address.net another.custom.address.xyz some.malware.address.com another.blocked.address.xxx


~317K SLoC