Skip to content

A simple script to block ads system-wide on Linux, using Dnsmasq configuration

License

Notifications You must be signed in to change notification settings

sambonbonne/linux-adblocker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

Another ad blocker for Linux, system-wide, without /etc/hosts modification and using Dnsmasq.

Dependencies

  • Dnsmasq
  • curl
  • grep (no need for extended regexp)
  • awk
  • sudo

Usage

Run sh adblocker.sh on and you're done.

Want to have ads back? Simply run sh adblocker.sh off.

The script will require your sudo password in order to create and remove a Dnsmasq configuration file.

Advanced configuration

If you know what you are doing, you can edit to variables at the beginning at the script:

  • DNSMASQ_CONF_DIR is the Dnsmasq directory which will receive the adblocking configuration file
  • DNSMASQ_CONF_FILENAME is name of the adblocking configuration file

Do not edit ADBLOCKER_CONF_FILE as it is based on the two previous variables.

Information

Compatibility

This script is compatible with any Linux distro using Dnsmasq.

Tested on Fedora 33 Silverblue. If you tested on another system, please open an issue so I can add it here.

Blocking lists

This script uses the Energized Blu list and Adaway list.

Note that I am not affiliated to any of these providers.

Why Dnsmaq

This script keeps /etc/hosts clean so you can edit it without opening a big 200k+ lines file.

And if you have some automatic tools which already edit the hosts file, it won't conflict!

Caution: it does not mean that editing /etc/hosts is bad, this script is just another method to block ads on some systems.

Other adblocking scripts

Those script modify the /etc/hosts file (so it works perfectly on any Linux and Mac operating system).

I am not affiliated to any of this project. If you know another system-wide adblocking script, you can open an issue so I can add it to this list.

About

A simple script to block ads system-wide on Linux, using Dnsmasq configuration

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages