😅 Would you say it’s possible to invest one minute now to instantly double your productivity?
Watch out. The following trick can make you a productivity animal in no time. Here it is: 👇
🛑 Block all websites that are not leading you towards your goal. Extremely simple but powerful nonetheless.
Here’s how you do it on Windows:
- Type “
Editor” into your search bar.
- Right-click on the icon and open as an administrator.
- In the editor, navigate to and open the file
"Windows > System32 > drivers > etc > hosts"(can be a
.dator any other format).
- Add the line
127.0.0.1 example.comto block the site
- Repeat adding lines until you’ve blocked all websites that drain your energy and time.
- Enjoy killer productivity levels never seen before.
Here’s a small step-by-step video that shows you how to do this…
Implement this tip today, and you’ll instantly double, if not triple, your productivity. No BS. It’ll take you no time and will be the most profitable minute you’ve ever had. There’s no excuse. Do it now!
Bonus: How to Block a Website on Your Mac? 🍎
A common question from visitors of this blog post is how to do the same in macOS?
Blocking a website on macOS using the
hosts file involves redirecting the domain name of the website you want to block to a non-routable IP address, such as
127.0.0.1 (the local loopback address).
Step 1: Open Terminal:
You can find the Terminal application in the
Utilities folder within the
Applications folder, or you can search for it using Spotlight.
Step 2: Backup your current hosts file (optional but recommended):
In Terminal, type the following command and press Enter:bash
sudo cp /etc/hosts /etc/hosts-backup
Step 3: Edit the hosts file:
Type the following command in Terminal and press
sudo nano /etc/hosts
This will open the
hosts file in the
nano text editor with superuser privileges.
Step 4: Add the websites you want to block:
Scroll to the bottom of the file.
On a new line, type
127.0.0.1 followed by a space, and then the domain name of the website you want to block. For example:
If you want to block multiple websites, add each one on a new line:
127.0.0.1 www.example1.com 127.0.0.1 www.example2.com
Step 5: Save and exit:
Control + Oto save the file.
Control + Xto exit the nano editor.
Step 6: Flush the DNS cache:
To ensure that your changes take effect immediately, you should flush the DNS cache. Type the following command in your Terminal and press
sudo dscacheutil -flushcache
Step 7: Test the changes:
Open a web browser and try to access the website you blocked. It should be inaccessible. Here’s an example where I blocked
Step 8: Revert changes (if needed):
If you ever want to unblock the websites or revert your changes, you can either manually remove the entries from the
hosts file or restore from the backup you created in step 2. To restore from the backup, use the following command in Terminal:
sudo cp /etc/hosts-backup /etc/hosts
⚡ Blocking websites using the
hosts file is a system-wide change, so it will affect all users on the computer.
Also check out our recommended blog post:
🛑 Recommended: Block Websites Using Python in Windows
Also, you may want to remove ads completely from your browsing experience to boost your productivity even further.
While working as a researcher in distributed systems, Dr. Christian Mayer found his love for teaching computer science students.
To help students reach higher levels of Python success, he founded the programming education website Finxter.com that has taught exponential skills to millions of coders worldwide. He’s the author of the best-selling programming books Python One-Liners (NoStarch 2020), The Art of Clean Code (NoStarch 2022), and The Book of Dash (NoStarch 2022). Chris also coauthored the Coffee Break Python series of self-published books. He’s a computer science enthusiast, freelancer, and owner of one of the top 10 largest Python blogs worldwide.
His passions are writing, reading, and coding. But his greatest passion is to serve aspiring coders through Finxter and help them to boost their skills. You can join his free email academy here.