FocusPocus: A Tiny Bash Spell to Keep You From Doomscrolling on Linux

A minimalist dark-mode Linux desktop with a glowing terminal window showing the command “focuspocus focus.” Behind the monitor, blurred icons of Facebook, YouTube, Instagram, and Reddit fade away in smoky blue haze, symbolizing disappearing distractions.

I’ll be honest: some days I open my terminal with the noble intention of being productive… and five minutes later I’m somehow watching a video titled “Top 10 Times a Goat Won an Argument.” On Linux. Inside Brave. While Slack sits in the background wondering where its life went wrong.

If you’re a Linux user, you probably pride yourself on being lean, efficient, and allergic to unnecessary bloated apps. But let’s not lie to each other—we still get sucked into Facebook notifications, YouTube rabbit holes, and Instagram reels that were clearly engineered in a lab to chew up your life.

So I built a tiny tool for people like us. A little spell.
A little… FocusPocus.

Yep, the name is ridiculous. And yes, that’s the point.


Why We Keep Getting Distracted (Even on Linux)

Linux gives you full control of your machine. And with great power comes great ability to waste time in creative ways.

A few classic distraction traps:

  • “I’ll just check YouTube for one quick tutorial.” → suddenly an hour disappears.
  • “I’m only opening Facebook because of that one message.” → you end up scrolling Tita Susan’s 47-photo album of her cat’s birthday.
  • “Let me open Reddit real quick.” → you forget what year it is.

The problem isn’t willpower. The problem is friction.

Apps like Facebook, YouTube, IG, TikTok… they’re designed for zero friction. Your brain sees the slightest hint of boredom and opens them instinctively.

The cure? Add friction back.

Not a whole firewall. Not a corporate-level blocker. Just enough resistance to snap you out of autopilot.


Introducing FocusPocus: A Tiny Bash Script With Big Attitude

FocusPocus is a minimal, no-nonsense, no-electron-app, no-daemon bash script that flips your /etc/hosts between:

  • focus mode → distracting sites get redirected to 127.0.0.1
  • pocus mode → distractions are unblocked so you can enjoy life after work

It does one job really well: Stops you from sabotaging your own productivity.

  • You run it manually.
  • You control it.
  • No background processes. No spyware-level blocking. No “AI wellness assistant” trying to parent you.

Just a tiny Linux incantation.

Grab it here:
👉 https://github.com/easterncoder/focuspocus


How It Works (Simple Enough to Read in a Coffee Break)

FocusPocus manipulates the classic distraction-blocking technique:

1. Editing /etc/hosts

When you run:

focuspocus focus

The script looks for lines in your /etc/hosts file that contain the string “#distraction” and uncomments them so:

#127.0.0.1 facebook.com www.facebook.com #distraction
#127.0.0.1 youtube.com www.youtube.com #distraction

becomes:

127.0.0.1 facebook.com www.facebook.com #distraction
127.0.0.1 youtube.com www.youtube.com #distraction

Your browser suddenly loses the ability to see those sites.

Instant friction.

When you run:

focuspocus pocus

It does the reverse, commenting lines that has the string “#distraction” and poof, you can play.

BUT not without asking you to solve two easy math problems first. Once more, instant friction before you can play… a nudge to maybe convince you to get back to work instead of immediately falling into the world of doom-scrolling.

2. It’s Ultra-Minimal

  • No dependencies.
  • No background services.
  • Not even a config file.

Just a tiny bash script that does exactly what it says.

3. It Doesn’t Fight You

The goal isn’t to imprison you in monk mode forever.

It’s to give you a toggle.

You choose when to work. You choose when to scroll memes.

FocusPocus simply keeps the two from mixing.


Why FocusPocus Works Better Than Browser Extensions

I’ve tried all the usual suspects:

  • StayFocusd
  • LeechBlock
  • Forest
  • Cold Turkey
  • Anything with “productivity” or “mindfulness” in the title

They all work… until they don’t.

  • Browser extensions? Disable them in two clicks.
  • Account-based blockers? Log out.
  • Electron apps? They burn RAM like crazy.
  • DNS blockers? Too heavy-handed.
  • Complicated firewall rules? Overkill.

FocusPocus wins because:

  • It’s stupidly simple.
  • It’s system-level.
  • It’s reversible in one command.
  • Your muscle memory can’t cheat it.

It’s the productivity equivalent of placing the chips on the highest shelf where you’re too lazy to reach them.


Practical Use Cases (A.K.A. Where This Spell Actually Helps)

1. Work Sprints

You need 90 minutes of undisturbed coding?

focuspocus focus

Boom. No dopamine traps.

2. Studying or Reading Docs

Stop “accidentally” switching to YouTube mid-paragraph.

3. Deep Work → Then Leisure

When you’re done:

focuspocus pocus

Now you can binge videos guilt-free.

4. Pair It With Cron (Optional Magic)

If you’re like me where you know you have to work when you’re in front of your workstation, then you can use cron to automatically switch back to focus mode regularly.

Just add this to root’s cron and you automatically get back to work on whatever schedule you set.

Example: Reset to focus mode every 15 minutes

*/15 * * * * /usr/local/bin/focuspocus focus

Boom. Back to work!

Note: You cannot “pocus” via cron as it asks you a couple math questions to solve. It also has to be root’s cron as super user access is required to edit /etc/hosts.


Installation (Ridiculously Simple)

Just copy and paste this on your Linux terminal.

(sudo curl -fsSL https://raw.githubusercontent.com/easterncoder/focuspocus/main/focuspocus -o /usr/local/bin/focuspocus || sudo wget -qO /usr/local/bin/focuspocus https://raw.githubusercontent.com/easterncoder/focuspocus/main/focuspocus) && sudo chmod +x /usr/local/bin/focuspocus

Then run it from anywhere.


Why I Built It

Because I’m tired of losing 20-minute pockets of my life to algorithm-driven nonsense.

As a dev, my job is to build things—not get emotionally invested in whether someone liked my meme.

FocusPocus is my line in the sand. A tiny productivity booster that doesn’t try to run your life. A tool that does exactly one job but does it well.

If it works for me, there’s a good chance it’ll work for you too.

Now stop scrolling and go write code. Or block yourself from scrolling. Either way, FocusPocus has your back.


Contribute or Fork

FocusPocus is licensed under GPL so you can go ahead and modify it your heart’s desire. Just remember to follow GPL rules.

Have suggestions? Just submit a pull request.