| Crates.io | blckr |
| lib.rs | blckr |
| version | 0.1.2 |
| created_at | 2025-08-31 05:19:38.528836+00 |
| updated_at | 2025-12-11 04:26:29.483423+00 |
| description | simple rust website blocker cli for linux systems |
| homepage | |
| repository | https://github.com/adhanani05/blckr |
| max_upload_size | |
| id | 1818169 |
| size | 14,498 |
Simple, fast CLI to block and unblock websites on Linux. Designed for quick focus sessions without heavyweight tooling. Includes persistent session history, user presets, and optional automated scheduling.
cargo install blckr
sudo install -Dm755 "$HOME/.cargo/bin/blckr" /usr/local/bin/blckr
cargo build --release
sudo install -Dm755 target/release/blckr /usr/local/bin/blckr
Block a domain:
sudo blckr block example.com
Unblock a domain:
sudo blckr unblock example.com
Root privileges are required because the tool writes to /etc/hosts.
blckr <action> <args>
block <domain> Add block entries to /etc/hosts
unblock <domain> Remove those exact entries
start <preset> Begin a block session using a preset
stop End the current block session
stats Show analytics from SQLite session history
preset add <name> <sites...>
Create a reusable preset
schedule add <cron> <preset>
Schedule automatic sessions (cron syntax)
# Basic blocking
sudo blckr block twitter.com
sudo blckr block www.youtube.com
sudo blckr unblock twitter.com
# Create a preset
blckr preset add deepwork twitter.com reddit.com youtube.com
# Use the preset
sudo blckr start deepwork
sudo blckr stop
# Schedule daily focus sessions
blckr schedule add "0 9 * * 1-5" deepwork
/etc/hosts modificationWhen blocking:
0.0.0.0 <domain>
::1 <domain>
These lines are appended only if the domain does not already appear anywhere in the file.
On unblock:
blckr.All persistent state is stored in a local SQLite database (blckr.db):
sessions tableTracks all blocking sessions.
Fields:
start_timeend_timeduration_minutessites_blockedpreset_usedUsed for analytics and history.
presets tableStores user-defined collections of sites.
Fields:
namesitesdefault_durationLets you create consistent focus modes like “deepwork” or “nosocial.”
schedules tableStores cron-style expressions for automated sessions.
Fields:
cron_exprpreset_nameLoaded on startup and registered as scheduled jobs.
blckr uses tokio-cron-scheduler to run automatic sessions.
On startup:
Note: The machine and blckr must be running for scheduled jobs to fire.
/etc/hosts path is fixed)/etc/hostsIf domains still resolve, flush your DNS:
systemd-resolved: sudo resolvectl flush-caches
nscd: sudo systemctl restart nscd
NetworkManager: sudo systemctl restart NetworkManager
Disable DNS over HTTPS in your browser.
Command not found:
Ensure $HOME/.cargo/bin is in your PATH.
Permission denied:
Use sudo for modifying /etc/hosts.
Domain still resolves after blocking:
getent hosts <domain>/etc/nsswitch.conf has files before dnsUnblock failed:
If lines were manually edited, remove them manually from /etc/hosts.
From crates.io:
cargo uninstall blckr
Remove the database:
rm -f blckr.db
Clean up any lingering /etc/hosts lines manually if needed.
Build:
cargo build --release
Run (writes to /etc/hosts):
sudo cargo run -- block example.com
Issues and PRs are welcome. Please keep changes minimal, predictable, and idempotent.
MIT