
Fogos
Minimal CLI tool written to block or unblock websites on your system by modifying /etc/hosts.
Overview
fogos is a small command-line utility built to do one thing reliably: block and unblock websites by editing /etc/hosts. It is written in Go, designed to be fast, and intentionally minimal. The idea was to avoid browser extensions or heavyweight tools and instead use a system-level approach that works across applications.
This project started as a quick weekend build but turned into a lesson in simplicity, usability, and restraint.
Problem
Website blockers tend to fall into two extremes:
- Over-engineered apps with dashboards, accounts, and background services
- Browser-only extensions that are easy to bypass
There was a clear gap for something:
- System-wide
- Lightweight
- Scriptable
- Not annoying to use
Personally, the trigger was needing a frictionless way to block a few distracting sites during work sessions without installing yet another app or keeping something running in the background.
Solution
fogos takes the simplest possible route: it directly modifies /etc/hosts to redirect unwanted domains. No daemons, no background processes, no dependencies beyond Go.
Design choices
- Single binary: easy to install, move, and remove
- Command aliases: short forms like
b,ub,s,lcame from repeatedly typing long commands during testing - Colour output: added late in development after realising plain text made status checks easy to miss
- Privilege separation: only block/unblock requires
sudo, everything else works as a normal user
Architecture notes (high-level)
- Reads and parses
/etc/hostssafely instead of blindly appending - Tracks blocked entries in a predictable format to avoid conflicts
- Keeps operations idempotent so repeated commands do not break state
A key constraint was resisting the urge to add features like scheduling or profiles. The goal was to keep it sharp and focused.
Developer Notes
Building and testing
The build process is intentionally straightforward:
- Clone the repository
- Run
make install - Verify with
fogos --help
Most testing was done manually on Linux and macOS by:
- Blocking/unblocking edge cases like subdomains
- Re-running commands to ensure no duplicate entries
- Checking behaviour without root privileges
One recurring issue during development was accidentally corrupting /etc/hosts while experimenting. That led to adding stricter parsing and safer write logic earlier than planned.
Anecdotes and lessons
- The first version simply appended lines. It worked until it didn’t. Cleaning up duplicates became a bigger problem than expected.
- Alias commands were not planned. They were added after getting annoyed typing
unblockrepeatedly. - Testing “just one more change” with
sudogets old quickly. That pushed better separation between read and write operations. - Considered adding Windows support early, but decided against shipping something untested.
Extensibility
The codebase is structured to allow:
- Additional commands without major rewrites
- Potential support for other blocking strategies
- Future cross-platform handling if needed
That said, the project intentionally avoids feature creep. Any extension needs to justify its place in a tool that is meant to stay minimal.
fogos is less about complexity and more about control. It reflects a preference for small tools that do one job well and stay out of the way.