Page 3 of 8 FirstFirst 12345 ... LastLast
Results 21 to 30 of 71

Thread: HOWTO: Amend your hosts file to block ads (by site)

  1. #21
    Join Date
    Apr 2006
    Location
    Montana
    Beans
    Hidden!
    Distro
    Kubuntu Development Release

    Re: HOWTO: Amend your hosts file to block ads (by site)

    Quote Originally Posted by DGINSD View Post
    I need help with using the update script, I'm very new with Ubuntu so I could use a little more detailed instruction on the process. keeps getting killed saying I dont have tofrodos.
    Read the post right above yours =)
    There are two mistakes one can make along the road to truth...not going all the way, and not starting.
    --Prince Gautama Siddharta

    #ubuntuforums web interface

  2. #22
    Join Date
    Feb 2011
    Beans
    411

    Re: HOWTO: Amend your hosts file to block ads (by site)

    Quote Originally Posted by bodhi.zazen View Post
    Read the post right above yours =)
    I tried that it didn't work. Tried it again and loaded dostounix (I think it was) as well and got it to work, but I have a few other questions as well.

    How often should this script be run to update the hosts (weekly, monthly) or is it a one time deal?

    Theres some conflicting posts in this thread about changing the host address to 0.0.0.0 instead of leaving them as 127.0.0.1 (or what ever standard is), some clairification on this? Safe to do? Evolution and other mail programs still work?

    Any other reccomended hosts lists to add?

    Thank you for your help and the info.

  3. #23
    Join Date
    Apr 2006
    Location
    Montana
    Beans
    Hidden!
    Distro
    Kubuntu Development Release

    Re: HOWTO: Amend your hosts file to block ads (by site)

    OK, glad you got it working.

    It is the same list as is used for AdblockPlus.

    Update, up to you. I think the list itself is updated either daily or almost daily. I personally update it (when I use a hosts file) every few months, sooner if I start seeing ads.

    On a desktop you could use either 0.0.0.0 or 127.0.0.1 , on a server (which I would not advise) you should probably use 127.0.0.1.

    You can use either, easy enough to switch if you have a problem.

    Alternates to a host file would include a proxy (privoxy) or using adblock extensions with your browser.
    There are two mistakes one can make along the road to truth...not going all the way, and not starting.
    --Prince Gautama Siddharta

    #ubuntuforums web interface

  4. #24
    Join Date
    Feb 2011
    Beans
    411

    Re: HOWTO: Amend your hosts file to block ads (by site)

    Quote Originally Posted by bodhi.zazen View Post
    OK, glad you got it working.

    It is the same list as is used for AdblockPlus.

    Update, up to you. I think the list itself is updated either daily or almost daily. I personally update it (when I use a hosts file) every few months, sooner if I start seeing ads.

    On a desktop you could use either 0.0.0.0 or 127.0.0.1 , on a server (which I would not advise) you should probably use 127.0.0.1.

    You can use either, easy enough to switch if you have a problem.

    Alternates to a host file would include a proxy (privoxy) or using adblock extensions with your browser.
    You say "when u use a hosts file" why would you ever need to do that, and how would you do that? Isn't the bennifit of using 0.0.0.0 faster site loading. Some recomended reading on using a proxy (its a totally new idea to me so I know nothing about it). I think what I meant by alternatives is additions to the host file such as know hijack sites and what not.

  5. #25
    Join Date
    Feb 2011
    Beans
    411

    Re: HOWTO: Amend your hosts file to block ads (by site)

    Quote Originally Posted by DGINSD View Post
    You say "when u use a hosts file" why would you ever need to do that, and how would you do that? Isn't the bennifit of using 0.0.0.0 faster site loading. Some recomended reading on using a proxy (its a totally new idea to me so I know nothing about it). I think what I meant by alternatives is additions to the host file such as know hijack sites and what not.
    Just realized I didn't phrase my first question correctly, what I meant was why would you ever not want to use a hosts file? What need would there be to do that?

  6. #26
    Join Date
    Apr 2006
    Location
    Montana
    Beans
    Hidden!
    Distro
    Kubuntu Development Release

    Re: HOWTO: Amend your hosts file to block ads (by site)

    Quote Originally Posted by DGINSD View Post
    Just realized I didn't phrase my first question correctly, what I meant was why would you ever not want to use a hosts file? What need would there be to do that?
    A hosts file is one option, other options include using a proxy (priviox / squid) and a third is extensions on browsers.

    Each has advantages and disadvantages.

    The disadvantage of a hosts file is that you need to manually keep the list up to date and you would have to keep it up to date on each desktop.

    The disadvantage of browser extensions is that they apply to a single browser for a single user. The advantage is that these lists are typically more up to date and easier to customize per user.

    For multiple users on a lan a proxy makes more sense, but it takes a bit more knowledge to set up and not all users may need the same content filtering.

    You will have to decide for yourself what makes the most sense.
    The
    There are two mistakes one can make along the road to truth...not going all the way, and not starting.
    --Prince Gautama Siddharta

    #ubuntuforums web interface

  7. #27
    Join Date
    Mar 2011
    Beans
    2

    Re: HOWTO: Amend your hosts file to block ads (by site)

    I had to log in just to thank you for this. I work in IT and never even knew about this.(never got deep into the internet\web part of IT)....What's got me so happy is I often work off of a broadband card when I'm out and about. I hate the freezing,especially any video(youtube,etc.) but just accepted it....until today. It's like i just went from a modem 54k to a DSL connection. THANK YOU!!!!!!!!!!!!!!!!!!!!!!!!

  8. #28
    Join Date
    Feb 2011
    Beans
    411

    Re: HOWTO: Amend your hosts file to block ads (by site)

    Quote Originally Posted by rocksockdoc View Post
    There is an unmentioned "problem" here, in practical terms, which can be rectified easily, if you know how.

    The problem is how to merge multiple huge hosts files and to rid yourself of duplicate entries.

    Just one solution is to use the following command post merger is to employ "sort -u".
    $ sudo sort -u /etc/hosts -o /etc/hosts

    Since you probably don't want the first few lines sorted, do a 'mark a'
    ma

    And then, just because, do a mark b:
    mb

    And then run the command:
    :'a,'b!sort -u

    Which is, "from a, to b, sort -unique".
    I need some help with this post I'm still finding my way around the terminal. The part I'm having trouble with is the mark A and mark B. How is this done, to mark certain lines, if possible a more detailed step by step? What directory, proper syntax to mark, or is that something that needs to be done with a text editor (the marking) to the hosts file it's self?

  9. #29
    Join Date
    Aug 2010
    Beans
    407
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: HOWTO: Amend your hosts file to block ads (by site)

    Quote Originally Posted by DGINSD View Post
    The part I'm having trouble with is the mark A and mark B. How is this done, to mark certain lines, if possible a more detailed step by step?
    I'll try to explain this but explaining 'vi' commands is, shall we say, a bit problematic, mainly because there are two modes and the commands only work in one of the two modes but there is no visual clue what mode you're in. Also, most of us have 'finger memory' ... which means the commands are embedded in our finger muscles - so - actually 'explaining' the steps is problematic. Those of you who know vi well know what I mean by that; if you don't know vi well, you won't really understand why that is the case. You'll learn.

    Lastly, it takes VASTLY more time to explain than the two or three keystrokes take to do ... so it' 'seems' confusing ... but it's really simple.

    First off, once in vi, you MUST clearly get yourself in the command mode by using the ESCAPE key religiously! (Hit it once, hit it twice, and, for good effect, if you're uncertain, hit it thrice!). You only need to hit it once, but, I need to underscore the point that you must be in the right mode.

    Also, you must be using a vi editor. There are lots of them. Vi, vim, Gvim, etc. (all will have 'vi' in the name somewhere). Or, just open up a terminal window and type:

    Code:
    vi /tmp/foo
    Once you have an empty file "foo" open, import the hosts file:
    Code:
    ESCAPE:r/etc/hosts
    The ":r" means to "read in" the file which follows "/etc/hosts".

    Now, with your "j" key, move down (use the "k" key to move up).

    At some point, hit "mx" (that will mark that spot as an "x"). Then use your "j" and "k" key again to go to a different spot and then hit "my". Now you've marked a spot as a 'y').

    At this point, do whatever you want between those two spots, e.g., to sort:
    :'x,'y!sort

    Which, interpreted, is:
    : = command
    'x = from x
    'y = to y
    !sort = run the sort command

    If things don't seem to work, hit the escape key a few times (and stay away from the 'i' key while doing commands.

    Hope this helps.
    Rock
    Last edited by rocksockdoc; April 25th, 2011 at 01:45 AM.

  10. #30
    Join Date
    Feb 2011
    Beans
    411

    Re: HOWTO: Amend your hosts file to block ads (by site)

    Firstly Thank you for the help, slowly but surely I'm learning

    I got it to work but a few more details I'd like. What is vi I guess I mean in contrast to an editor like gedit?

    When I do a "mx" should a physical mark be made on the document (e.g. an x) something to note you did it?

    Are there any other navigation keys other than j and k, as that could take a very long time to get to the bottlom of a large hosts file?

    Save and exit, how do I do it?

    I think thats it for now, again thank you for the help.

Page 3 of 8 FirstFirst 12345 ... LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •