Blocker is a simple, lightweight CLI website blocker written in Rust for Linux.
It modifies /etc/hosts to block distracting domains for a chosen amount of time, helping you stay focused.
- Add/remove domains from
/etc/hosts - List currently blocked domains
- Temporarily block all added domains for a set duration (e.g. 30min, 2h)
- Protected unblocking with a passphrase (prevents impulse decisions during focus sessions)
-
Install Rust (if not installed):
https://www.rust-lang.org/tools/install -
Clone and build:
git clone https://github.com/Lmpksels/blocker.git cd blocker cargo build --release -
Copy the binary
sudo cp -f target/release/blocker /usr/local/bin/blocker
# Add a domain
sudo blocker add example.com# Remove a domain
sudo blocker remove example.com# List blocked domains
blocker list# Temporary block
# Minutes
sudo blocker block 30 min# Hours
sudo blocker block 2h# Unblock (10000 keystroke passphrase)
sudo blocker unblock# Run as systemd service (recommended)
#1 access blocker.service
sudo nano /etc/systemd/system/blocker.service#2 paste the following text into blocker.service
[Unit]
Description=Blocker Daemon
After=network.target
[Service]
ExecStart=/usr/local/bin/blocker daemon
Restart=always
User=root
WorkingDirectory=/root
[Install]
WantedBy=multi-user.target#3 Reload system and enable service
sudo systemctl daemon-reexec
sudo systemctl daemon-reload
sudo systemctl enable blocker#4 Start the service
sudo systemctl start blocker
sudo systemctl status blockerMaking sure this runs after rebooting the system and killing the running process becomes harder for the given amount of time.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Licensed under MIT License.
© 2026 Luuk Kessels