A terminal-based productivity tool that helps you focus better by blocking distracting websites like YouTube, Instagram, Reddit, and more β right from your Linux terminal.
Add or remove custom websites anytime and toggle Focus Mode with a single command.
FocusMode temporarily modifies your /etc/hosts file to block distracting sites by redirecting them to 127.0.0.1.
It automatically backs up and restores your original configuration once you disable Focus Mode.
Perfect for:
- π§βπ» Developers
- π Students
- βοΈ Writers
- β‘ Anyone who wants to stay focused
- π« Blocks common distracting websites
- β Add your own URLs anytime
- ποΈ Remove blocked sites easily
- πΎ Saves list persistently in
~/.focus_blocklist - π One command to enable or disable focus mode
- π Backs up your
/etc/hostsautomatically
git clone https://github.com/thelinuxpoint/focusmode.git
cd focusmode
chmod +x focusmode.sh
sudo cp focusmode.sh /usr/local/bin/focusmodeRun Focus Mode with:
sudo focusmodeββββββββββββββββββββββββββββββββββββββββ
β π§ Focus Mode Tool v2.0 β
ββββββββββββββββββββββββββββββββββββββββ
1) Enable Focus Mode
2) Disable Focus Mode
3) View Block List
4) Add Custom Site
5) Remove Custom Site
6) Exit
FocusMode works by redirecting websites to 127.0.0.1 through your /etc/hosts file.
When enabled:
127.0.0.1 youtube.com
127.0.0.1 instagram.com
127.0.0.1 reddit.com
When disabled:
- The original
/etc/hostsfile is restored from:/tmp/hosts_focus_backup
Your custom blocklist is stored in:
~/.focus_blocklist
You can edit this file manually or through the menu options.
Example:
www.youtube.com
twitter.com
reddit.com
chat.openai.com
- Run this tool with
sudofor full functionality. - Keep your
~/.focus_blocklistshort and meaningful. - Combine with
timer.shortunes.shfor the ultimate productivity setup.
Prakash Choudhary β @TheLinuxPoint
πΊ YouTube: The Linux Point
π· Instagram: @thelinuxpoint
This project is licensed under the MIT License β feel free to modify and distribute.
If FocusMode helps you stay productive:
- π Give this project a star
- π Follow me on GitHub
- π¬ Share it with your friends or on Reddit!
βDiscipline is choosing between what you want now and what you want most.β
β Abraham Lincoln