A simple way to prevent any packets being sent to or received from Facebook from your hardware is to set up filtering using iptables, a kernel-level firewall. On most GNU and Linux distributions, you can run the following three commands as root:
iptables -A INPUT -d facebook.com -j DROP
iptables -A OUTPUT -d facebook.com -j DROP
iptables -A FORWARD -d facebook.com -j DROP
The URL can be changed for other sites as well if you wish. Eg - for Twitter's "tweet" buttons run the same commands but using platform.twitter.com as the domain to reject. I also recommend adding Facebook's content delivery network: fbcdn.net to the blacklist.
For more documentation on iptables, I recommend the Arch Wiki - wiki.archlinux.org/index.php/I…