It doesn't work though. All of those sites have backup domains that easily allow you to access them. To properly block all of facebook, you have to block something like 30 domains.
It's so you can't log in and read stuff, or get sucked down a distracting click-hole of videos, jokes, chit-chat and bullshit. It breaks the reflexive bookmarks, links from other sources and general habitual url visiting.
No, I mean literally, if I paste those strings into my etc/hosts it won't block any of those sites. It simply doesn't work. You can still load the sites. It takes stronger measures to block them. I have to edit my hosts file all the time for work anyway, so I ended up installing SelfControl and I turn it on when I feel like I need it.