Blocking Websites with /etc/hosts

Rather then make this block using /etc/hosts I'd suggest using a browser addon/plugin such as this one named: BlockSite for Firefox or StayFocusd for Chrome.


  ss #1


                    ss #2

But I want to really use /etc/hosts file

If you must do it this way you can try adding your entries like this instead:

You should never add entries to this file other than hostnames. So don't put any entries in there that include prefixes such as http:// etc.

You need to flush your DNS cache. According to this article, you can do that by restarting the following services:

  • nscd
  • dnsmasq
  • named