Here’s an easy way to block annoying advertisement and malware sites using ‘/etc/hosts’ file.
First edit the /etc/hosts files using your favorite text editor :
sudo gedit /etc/hosts
Close the file, and Save. The change will take effect immediately after that. One of the side-effect from this modfication is that your web surfing experience would be significantly faster because your browser does not have to wait for the annoying advertisement to load.