How to block Twitter or Reddit

Is some specific website, like Twitter, bringing you joy or is it bringing you the opposite? Do you have a hard time stopping? Here's a quick tutorial recommended by 9 out 10 dentists.

nout

6. Mai 2023May 6, 2023 · 2 Min. Lesezeit2 min read

(This is a repost from my original article for Stacker News)

Is some specific website, like Twitter, bringing you joy or is it bringing you the opposite? Do you have a hard time stopping? Here's a quick tutorial recommended by 9 out 10 dentists.

***First rule:** Never run random bash scripts you find online without reading the scripts yourself!*


Blocking with /etc/hosts#

If you understand the first rule, then read, copypaste and run following script in your terminal.

On Linux or MacOS

sudo bash -c "cat >> /etc/hosts << EOF

0.0.0.0 twitter.com
0.0.0.0 reddit.com
EOF
"

And that's it. This should apply the rule immediately. If you want to check how does your /etc/hosts look like, then just run nano /etc/hosts.

On Windows

echo 0.0.0.0 twitter.com >> %WINDIR%\System32\Drivers\Etc\Hosts
echo 0.0.0.0 reddit.com >> %WINDIR%\System32\Drivers\Etc\Hosts

Blocking with pi-hole#

Even better option is if you have pi-hole set up on your network to proxy all your DNS requests. If you didn't know pi-hole is also available on Umbrel or Citadel.

Simple steps:

  1. Sign in to your your pi-hole admin interface, e.g. https://pi.hole/admin/index.php
  2. Navigate to Blacklist
  3. Add twitter.com in the Domain input box and click on Add to Blacklist
  4. You are all set.
#dns#reddit#twitter

Written by

Comments

No comments yet. Start the conversation.

Contents

2 sections

  1. Blocking with /etc/hosts
  2. Blocking with pi-hole