This question already has an answer here:
I want to block all, but one or two websites. This question is therefore relatively close to, but different from the following
- Parental controls with different settings for different users (difference: Parental control is not really a good flashship.)
- How to block websites temporarily? (difference: This is on how to block a particular website. I want to block everything except the ones I need.)
I know that this can be done with leechblock (for FF) or something similar for other browsers. I think that is not a very clean solution, because it is browser-based. I know this was both possible and easy with Firestarter but that package is deprecated.
I am looking for something which is both easy (not manually editing hosts, but a script for instance) and systemwide. It can use the CLI.
I would love a relatively detailed answer rather than just links to other websites - screenshots would be most welcome.