{"id":22900552,"url":"https://github.com/rioastamal/shfokus","last_synced_at":"2025-05-08T01:24:28.383Z","repository":{"id":145535323,"uuid":"291271750","full_name":"rioastamal/shfokus","owner":"rioastamal","description":"shFokus is Bash script to make you focus and stay productive by blocking distracting websites such as Facebook, Youtube etc.","archived":false,"fork":false,"pushed_at":"2020-09-16T19:37:38.000Z","size":15,"stargazers_count":25,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-31T16:11:31.083Z","etag":null,"topics":["bash","productivity","shell-script","utilities"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rioastamal.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-08-29T12:58:56.000Z","updated_at":"2025-03-03T10:04:08.000Z","dependencies_parsed_at":null,"dependency_job_id":"6211557d-854b-46e0-a398-bd2c70fd84c4","html_url":"https://github.com/rioastamal/shfokus","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rioastamal%2Fshfokus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rioastamal%2Fshfokus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rioastamal%2Fshfokus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rioastamal%2Fshfokus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rioastamal","download_url":"https://codeload.github.com/rioastamal/shfokus/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252979876,"owners_count":21835130,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bash","productivity","shell-script","utilities"],"created_at":"2024-12-14T01:28:47.359Z","updated_at":"2025-05-08T01:24:28.371Z","avatar_url":"https://github.com/rioastamal.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"## About shFokus\n\nshFokus is Bash script to make you focus and stay productive by blocking distracting websites such as Facebook, Youtube, Twitter etc. It does the job by modifying your HOSTS file. So when you try to open those distracting websites it will go nowhere.\n\n## Requirements\n\n- Unix or Unix like based OS such as MacOS or Linux. (Windows is not tested)\n- Bash version \u003e= 3.2.57\n\n## Installation\n\nMethod 1 - Clone the project repository from GitHub.\n\n```\n$ git clone git@github.com:rioastamal/shfokus.git\n```\n\nMethod 2 - Download the zipped version from GitHub.\n\n```\n$ curl -O -L 'https://github.com/rioastamal/shfokus/archive/master.zip'\n```\n\nAnd then extract to your desired directory.\n\n## Usage and Examples\n\nRunning shFokus with `-h` flag will give you list of options and examples.\n\n```\n$ bash ./shfokus.sh -h\n```\n\n```\nUsage: ./shfokus.sh [OPTIONS]\n\nWhere OPTIONS:\n  -a ACTION     Specify action name using ACTION.\n  -f FILE       List of blocked websites from FILE. Default is ~/.shfokus. Will\n                be created if not exists.\n  -h            Print this help and exit.\n  -r            Dry run mode. Print the content that will be written to hosts\n                file.\n  -t MINUTES    Specify how long in MINUTES sites should be blocked/unblocked.\n                Default is '0' which means blocked/unblocked forever. Make sure\n                there is no other shfokus instance running.\n  -v            Display shFokus version.\n\nList of available ACTION:\n  - block    -\u003e block website\n  - unblock  -\u003e release block\n\nExample of ~/.shfokus (one domain per line):\n  youtube.com\n  www.youtube.com\n  facebook.com\n  www.facebook.com\n\nExample 1 - Block distracting websites:\n\n  $ sudo bash ./shfokus.sh -a block\n\nExample 2 - Block distracting websites in 30 minutes:\n\n  $ sudo bash ./shfokus.sh -a block -t 30\n\nExample 3 - Unblock distracting websites.\n\n  $ sudo bash ./shfokus.sh -a unblock\n\nExample 4 - Unblock distracting websites in 10 minutes.\n\n  $ sudo bash ./shfokus.sh -a unblock -t 10\n\n-------------------------------- About shFokus --------------------------------\n\nshFokus is Bash script to make you focus and stay productive by blocking\ndistracting websites such as Facebook, Youtube etc.\n\nshFokus is free software licensed under MIT. Visit the project homepage\nat https://github.com/rioastamal/shfokus.\n```\n\n### Create List of Distracting Websites\n\nBear in mind that this step is optional, if you skip this step shFokus will create it automatically. By default it will block Facebook, Youtube, Instagram, Twitter, Twitch and Netflix.\n\nLet's start by creating list of websites that should be blocked. By default shFokus will search for `~/.shfokus` file to determine list of websites. In this example we are going to block Facebook and Twitter.\n\n```\n$ vi ~/.shfokus\n```\n\n```\nfacebook.com\nwww.facebook.coom\ntwitter.com\nwww.twitter.com\n```\n\nAs you can see above you need to specify one domain per line.\n\n### Block Distracting Websites\n\nBecause modifying HOSTS file `/etc/hosts` require root privilege then you need to run the command as root or with sudo. To start blocking use option `-a block`.\n\n```\n$ sudo bash ./shfokus.sh -a block\n```\n\n```\nStay focus and productive -- Have a great day :)\n```\n\nIf you're concern about what shFokus about to write to your HOSTS file then you can run in dry-run mode first. By running in dry-run mode it will not touch your HOSTS file instead it will print to STDOUT.\n\n```\n$ bash ./shfokus.sh -a block -r\n```\n\n```\n...\n# Added by Docker Desktop\n# To allow the same kube context to work on the host and the container:\n127.0.0.1 kubernetes.docker.internal\n# End of section\n# shfokus_begin - DO NOT TOUCH\n0.0.0.0 facebook.com www.facebook.coom twitter.com www.twitter.com\n# shfokus_end\nStay focus and productive -- Have a great day :)\n```\n\nNotice that shFokus add new entry between `# shfokus_begin` and `# shfokus_end` at the end of HOSTS file.\n\n### Block for Specific Duration\n\nIf you want block distracting websites for specific duration then use `-t` option. It accept value in minutes.\n\n```\n$ sudo bash ./shfokus.sh -a block -t 60\n```\n\n```\nStay focus and productive -- Have a great day :)\nBlock will be released in 3587 sec... CTRL+C to unblock\n```\n\nBlock will automatically released in 60 minutes. If you want to release earlier use CTRL+C.\n\n```\n----- Interrupted by CTRL+C -----\nDistracting websites has been unblocked -- Enjoy your day :)\n```\n\n### Unblock Distracting Websites\n\nTo release block of distracting websites use option `-a unblock`. It will remove values from your HOSTS file.\n\n```\n$ sudo bash ./shfokus.sh -a unblock\n```\n\n```\nDistracting websites has been unblocked -- Enjoy your day :)\n```\n\n### Unblock Distracting Websites for Specific Duration\n\nIf you want unblock websites for specific duration then use `-t` option. Same as block it accept value in minutes.\n\n```\n$ sudo bash ./shfokus.sh -a unblock -t 10\n```\n\n```\nWebsites will be blocked in ${SECONDS_LEFT} sec... CTRL+C to block\n```\n\nWebsites will be unblocked temporarily for 10 minutes. If you want to block earlier use CTRL+C.\n\n```\n----- Interrupted by CTRL+C -----\nStay focus and productive -- Have a great day :)\n```\n\n## Author\n\nshFokus is written by Rio Astamal \u0026lt;rio@rioastamal.net\u0026gt;\n\n## License\n\nshFokus is open source licensed under [MIT license](http://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frioastamal%2Fshfokus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frioastamal%2Fshfokus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frioastamal%2Fshfokus/lists"}