If this is your first visit, be sure to
check out the FAQ. You will have to register
before you can post. To start viewing messages,
select the forum that you want to visit from the selection below.
Please do not use the CODE tag when pasting content that contains formatting (colored, bold, underline, italic, etc).
The CODE tag displays all content as plain text, including the formatting tags, making it difficult to read.
Announcement
Collapse
No announcement yet.
Script to automate building an adblocking hosts file
Ya, I'll get over it. Just a small case of brain envy!
(I hadn't noticed that "two hour" thing last November...)
"A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
– John F. Kennedy, February 26, 1962.
Nope. I plan to add the extra functionality discussed here: KDialog and an easy-on-off mechanism at least. A relatively simple tailoring mechanism like what you described earlier shouldn't be too difficult, either.
Alas, it's easy to get distracted! I have some air travel coming up, and Alaska Air has wi-fi on all planes now, so perhaps I can put those five hours on SEA-DCA to good use, eh?
Just created SR's script and ran it and replaced my /etc/hosts file accordingly. Rebooted. Browsing does indeed seem more responsive - snappier. Cool.
Note: I at least, could not execute the script by just typing gethosts. Kept getting "gethosts: command not found". Executing it with
Code:
./gethosts
works.
Windows no longer obstructs my view.
Using Kubuntu Linux since March 23, 2007.
"It is a capital mistake to theorize before one has data." - Sherlock Holmes
Save the text above into a file called ~/gethosts.
I followed Steve's instructions exactly as stated to above -- which saves the file in the users home directory.
Windows no longer obstructs my view.
Using Kubuntu Linux since March 23, 2007.
"It is a capital mistake to theorize before one has data." - Sherlock Holmes
The script outputs the file ~/hosts-block. Each time you run it, you'll need to manually replace your existing host file with this command:
Code:
sudo cp ~/hosts-block /etc/hosts
Instead of manually doing this, why not just have it in the script? It seems to do fine for me. Also, I was thinking of using KDE's Autostart instead of a weekly cron job, but it seems there are issues with it because there are no options to run weekly, as Windows does, unless someone knows of another option?
Comment