Block Malware and Tracking Sites

Instead of using a personal firewall or other host-based detection system to filter unwanted traffic (tracking sites, malware, etc.), use the good old “/etc/hosts/” file to create a natural filter.

Use Steven Black hosts file to get a list of FQDNs to block.

Instead of directing traffic to, redirect it to an IP you own with a web server that will respond with an empty page. I found that this speeds things up by not leaving the browser hanging trying to connect to a server that doesn’t exist. In my example, I use as the catch-all.

curl -O

sed -i '' -e 's/0\.0\.0\.0 0\.0\.0\.0//g' hosts

sed -i '' -e 's/0\.0\.0\.0/' hosts

sudo cp hosts /etc/hosts

rm hosts