DeLi(cate) Forum
Adblocker - Printable Version

+- DeLi(cate) Forum (http://delicate-linux.net/forum)
+-- Forum: DeLi(cate) Linux [english only] (/forumdisplay.php?fid=3)
+--- Forum: Other (/forumdisplay.php?fid=8)
+--- Thread: Adblocker (/showthread.php?tid=451)



Adblocker - nl2stk - 10-26-2015 09:36 AM

The web is full of advertising. On the low-end machines it takes memory and slow you' re browsing (unless you're using a terminal based browser). A while ago I discovered a simple script that puts a list of unwanted garbage in the host file. In other words, it doesn't matter what browser you use it saves from most of the advertising hell Smile

(1) Install sudo with pacman (the script need it)
(note: this solution was from an Ubuntu forum, that's why 'sudo' is used)
(2) Put your name in the etc/sudoers file
(3) Create a new file called hosts.0 with sudo cp /etc/hosts /etc/hosts.0
(4) Create a file newhosts.sh in ~/bin which looks like this:

Code:
#!/bin/bash
# get MVPS hosts file to block ad sites and merge it with our hosts file
wget -O - http://www.mvps.org/winhelp2002/hosts.txt | sed 's/[[:space:]]*#.*$//g;' |
    grep -v localhost | tr ' ' '\t' | tr -s '\t' | tr -d '\015' | sort -u >/tmp/hosts0
cat /etc/hosts.0 /tmp/hosts0|sudo dd of=/etc/hosts
rm -f /tmp/hosts0

(5) Make it executable with: chmod +x newhosts.sh

Run it and say goodbye to most of the advertisments Smile

Some backgroundinformation (what is does and works)
Blocking websites (or content) can be regulated with the /etc/host file
This script downloads a file which contains a list of advertisment companies and merged it into the host file. Once in a while this file is updated so you don't have to do it everytime by hand, just run the script and your up to date.
It saves you time and memory Smile

Goodluck!