Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Tue 11 Dec 2018, 09:22
All times are UTC - 4
 Forum index » House Training » HOWTO ( Solutions )
How to manually block advertisements with /etc/hosts
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 2 of 2 [26 Posts]   Goto page: Previous 1, 2
Author Message
tallboy


Joined: 21 Sep 2010
Posts: 1078
Location: Oslo, Norway

PostPosted: Mon 05 Nov 2018, 00:07    Post subject:  

musher0 wrote:
tallboy wrote:
I have never used Windows (...)
Wwwwhhhhhaaaaaaattttt? Wink

First reaction:
You dropped to Earth from Aldebaran yesterday, yes? Twisted Evil

Second reaction:
tallboy must be a saint. Laughing He took a vow of no-WhineDose when he
entered his monastic order. Laughing

Wink

I came here with blessings from the planet Mac, I will not harm your RAM! Mr. Green
I have to admit that a few programs at the Uni were available for Windoze only, but they always included a very good manual! Razz

_________________
True freedom is a live Puppy on a multisession CD/DVD.
Back to top
View user's profile Send private message 
musher0

Joined: 04 Jan 2009
Posts: 13152
Location: Gatineau (Qc), Canada

PostPosted: Fri 09 Nov 2018, 12:29    Post subject:  

Ah. That explains it! Very Happy
_________________
musher0
~~~~~~~~~~
Je suis né pour aimer et non pas pour haïr. (Sophocle) /
I was born to love and not to hate. (Sophocles)
Back to top
View user's profile Send private message 
musher0

Joined: 04 Jan 2009
Posts: 13152
Location: Gatineau (Qc), Canada

PostPosted: Fri 09 Nov 2018, 12:32    Post subject:  

linuxcbon wrote:
Two more things :

1/ how to sort the hosts file alphabetically :
# sort +1 -2 /etc/hosts > toto.txt
toto.txt is the new sorted file.

2/ then you can remove duplicates from toto.txt and update hosts :
uniq toto.txt > /etc/hosts
I believe you can do this in one shot with
Code:
# sort +1 -2 -u /etc/hosts > toto.txt

_________________
musher0
~~~~~~~~~~
Je suis né pour aimer et non pas pour haïr. (Sophocle) /
I was born to love and not to hate. (Sophocles)
Back to top
View user's profile Send private message 
tallboy


Joined: 21 Sep 2010
Posts: 1078
Location: Oslo, Norway

PostPosted: Sun 11 Nov 2018, 23:29    Post subject:  

linuxcbon and musher0, the guys at winhelp2002 must have read your posts about sorting and removing duplicates, because their latest HOSTS is only 14176 lines long! Very Happy

Correction: After running the script, it shrank to 13981 active lines, so they haven't read your posts after all! Sad

_________________
True freedom is a live Puppy on a multisession CD/DVD.
Back to top
View user's profile Send private message 
musher0

Joined: 04 Jan 2009
Posts: 13152
Location: Gatineau (Qc), Canada

PostPosted: Mon 12 Nov 2018, 00:05    Post subject:  

How long did it take you to sort it?
_________________
musher0
~~~~~~~~~~
Je suis né pour aimer et non pas pour haïr. (Sophocle) /
I was born to love and not to hate. (Sophocles)
Back to top
View user's profile Send private message 
tallboy


Joined: 21 Sep 2010
Posts: 1078
Location: Oslo, Norway

PostPosted: Mon 12 Nov 2018, 22:29    Post subject:  

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.
Back to top
View user's profile Send private message 
tallboy


Joined: 21 Sep 2010
Posts: 1078
Location: Oslo, Norway

PostPosted: Sat 17 Nov 2018, 21:27    Post subject:
Subject description: My video works again!
 

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! Very Happy
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:
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. Very Happy

_________________
True freedom is a live Puppy on a multisession CD/DVD.
Back to top
View user's profile Send private message 
Ananda98


Joined: 03 Jul 2017
Posts: 17
Location: Bali, Indonesia

PostPosted: Sun 18 Nov 2018, 13:48    Post subject:  

Mmm... Nice idea. But, why don't use some addons that able to block advertisement?
Back to top
View user's profile Send private message 
mikeslr


Joined: 16 Jun 2008
Posts: 2834
Location: 500 seconds from Sol

PostPosted: Sun 18 Nov 2018, 15:20    Post subject:  

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.
Back to top
View user's profile Send private message 
Ananda98


Joined: 03 Jul 2017
Posts: 17
Location: Bali, Indonesia

PostPosted: Mon 19 Nov 2018, 08:55    Post subject:  

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)?
Back to top
View user's profile Send private message 
nosystemdthanks

Joined: 03 May 2018
Posts: 540

PostPosted: Mon 19 Nov 2018, 12:58    Post subject:  

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.

_________________
the end of the distro war, and the distro https://ptpb.pw/OnBT
Back to top
View user's profile Send private message Visit poster's website 
Display posts from previous:   Sort by:   
Page 2 of 2 [26 Posts]   Goto page: Previous 1, 2
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » House Training » HOWTO ( Solutions )
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0685s ][ Queries: 13 (0.0151s) ][ GZIP on ]