Hostblocking via /etc/hosts
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
jayvii 532daedb99 Moved to Script-group 4 years ago Moved to Script-group 4 years ago Moved to Script-group 4 years ago

Adblocking “/etc/hosts”

ATTENTION: Please read about the security concerns of using random scripts from the internet

The script downloads several adblock-lists and places their content into your /etc/hosts, redirecting those domains to (NULL).

This is a decent and effective way of blocking advertisement across all applications on your device and all devices connected to the internet through that device.

Substitude to “adblock” addons for your webbrowser.


  1. (outdated) Disconnect-list
  2. Adblock: Easylist
  3. Adblock: EasyPrivacy
  4. Adblock: AntiAdblock
  5. Adblock: Annoyancelist
  6. Adblock: Socialmedialist
  7. WinHelp: Adblocking
  8. Hostsfile: AntiAd & Protection
  9. Dan Pollock’s AntiAd
  10. Adblock: AntiMalware (disabled by default)


Copy this file to a place you’ll remember (eg: your home-directory). Run:

chmod +x /home/USER/.hostblockingscript

Now, you can run the script. As we do editing outside your home-folder, you need root-permissions. Note, that the script will also backup the original “/etc/hosts” file into your home-directory (~/.hostsbackup). This script needs to be run every now and then (I’d say every 2 weeks, min) to have full effect & protection.

su -c “./home/USER/.hostblockingscript” root


sudo sh /home/USER/.hostblockingscript