Giter Club home page Giter Club logo

block-websites's Introduction

Block Websites Script

This script helps you block or unblock a list of distracting websites, such as social media platforms, by modifying your /etc/hosts file. It can be used to increase productivity and avoid distractions.

Installation

  1. Download the script and place it in a directory of your choice.
  2. Open a terminal, navigate to the directory where the script is located, and run the following command to give the script execution permission:
chmod 777 block_websites.sh
  1. Optionally, you can create a symbolic link to the script to make it globally accessible from anywhere in your terminal. Run the following command, replacing /path/to/your/script with the actual path to the script:
sudo ln -s /path/to/your/script/block_websites.sh /usr/local/bin/block_websites

Now you can use the block_websites command instead of the script path.

Usage

To block distracting websites:

Run the following command:

sudo ./block_websites on

or, if you created a symbolic link:

sudo block_websites on

This command will block all websites listed in the arr variable inside the script by modifying the /etc/hosts file.

To unblock distracting websites:

Run the following command:

sudo ./block_websites off

or, if you created a symbolic link:

sudo block_websites off

This command will unblock all websites listed in the arr variable by removing their entries from the /etc/hosts file.

To add a new website to the list:

Run the following command, replacing example.com with the actual website you want to add:

sudo ./block_websites add example.com

or, if you created a symbolic link:

sudo block_websites add example.com

This command will update the script file, adding the new website to the arr variable. To block the newly added website, run the sudo block_websites on command again.

To remove a website from the list:

Run the following command, replacing example.com with the actual website you want to remove:

sudo ./block_websites remove example.com

or, if you created a symbolic link:

sudo block_websites remove example.com

This command will update the script file, removing the website from the arr variable. To unblock the removed website, run the sudo block_websites off command again.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.