How to manually block advertisements with /etc/hosts

How to do things, solutions, recipes, tutorials
Message
Author
User avatar
tallboy
Posts: 1760
Joined: Tue 21 Sep 2010, 21:56
Location: Drøbak, Norway

#21 Post by tallboy »

On my stone-age PC, a second or two I think, not much more.
True freedom is a live Puppy on a multisession CD/DVD.

User avatar
tallboy
Posts: 1760
Joined: Tue 21 Sep 2010, 21:56
Location: Drøbak, Norway

#22 Post by tallboy »

I discovered something very interesting after updating my /etc/hosts with the file from http://winhelp2002.mvps.org/hosts.htm as discribed above:
My video works again!
I have been getting warnings about not having the codecs required to watch mp4 videos, so watching the news has been a pure text experience Not so anymore! :D
As I mentioned earlier, at he top of the sorted HOSTS file, here are commented-out links with comments attached, some are left intact because they affect video when they are blocked. Oh yes! Nice work by the guys at winhelp2002!
BTW, I removed the information text at the top of the HOSTS file, down to where the blocked links start, before sorting the file. After sorting I added the default lines to the top of the file, before saving it as /etc/hosts.

Code: Select all

127.0.0.1 localhost puppypc
192.168.1.1 pc2
192.168.1.2 pc3
192.168.1.3 pc4 
My lucid only uses puppypc as localhost name, but in both Xenial an BB puppies, there is a number added to the hostname. It is found in the file immidiately to the left of /etc/hosts, aptly named hostname. :D
True freedom is a live Puppy on a multisession CD/DVD.

User avatar
Ananda98
Posts: 56
Joined: Mon 03 Jul 2017, 10:04
Location: Bali, Indonesia

#23 Post by Ananda98 »

Mmm... Nice idea. But, why don't use some addons that able to block advertisement?

User avatar
mikeslr
Posts: 3890
Joined: Mon 16 Jun 2008, 21:20
Location: 500 seconds from Sol

#24 Post by mikeslr »

Ananda98 wrote:Mmm... Nice idea. But, why don't use some addons that able to block advertisement?
Unless my sometimes flaky memory is mistaken, on another thread it was mentioned that Menu>Internet>Pup-Advert Blocker gave you a choice of which of three subsets (you can choose all) of all the possible 'blocks' you could manually set; such subsets having been chosen by the three "packaging" organizations.

It is likely that web-browser addons do the same: choose what to block. These are nice and convenient. But using them means you are relying on someone else to make decisions. What Tallboy's last post tells us is that once you know what you are doing, making your own decisions can produce better results.

User avatar
Ananda98
Posts: 56
Joined: Mon 03 Jul 2017, 10:04
Location: Bali, Indonesia

#25 Post by Ananda98 »

mikeslr wrote:
Ananda98 wrote:Mmm... Nice idea. But, why don't use some addons that able to block advertisement?
Unless my sometimes flaky memory is mistaken, on another thread it was mentioned that Menu>Internet>Pup-Advert Blocker gave you a choice of which of three subsets (you can choose all) of all the possible 'blocks' you could manually set; such subsets having been chosen by the three "packaging" organizations.

It is likely that web-browser addons do the same: choose what to block. These are nice and convenient. But using them means you are relying on someone else to make decisions. What Tallboy's last post tells us is that once you know what you are doing, making your own decisions can produce better results.
Oh, I see. But, is there any risk if we use this method (editing manually)?

User avatar
nosystemdthanks
Posts: 703
Joined: Thu 03 May 2018, 16:13
Contact:

#26 Post by nosystemdthanks »

Ananda98 wrote:is there any risk if we use this method (editing manually)?
no, /etc/hosts is one of the easiest files to edit. its probably a good idea for most users to leave the lines at the top alone unless they have a good reason not to, because the ones that are relevant to this thread can always be appended to the bottom.

you would only change a site relevant to a website by removing it or changing the ip or adding to the bottom of the list.

two things that /etc/hosts cannot do is block websites by their ip (8.8.8.8) or websites that have dynamic subdomains (aekjfafsfjhksj.murga-linux.com) -- there are no wildcards like there are with files, and a few adhosts have several fixed subdomains, but a few nasty ones use random gibberish subdomains like randomly typed letters.

i still recommend using /etc/hosts since its very helpful and really very easy.
[color=green]The freedom to NOT run the software, to be free to avoid vendor lock-in through appropriate modularization/encapsulation and minimized dependencies; meaning any free software can be replaced with a user’s preferred alternatives.[/color]

Post Reply