Page 2 of 8 FirstFirst 1234 ... LastLast
Results 11 to 20 of 71

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

  1. #11
    Join Date
    Feb 2010
    Location
    Zagreb/Croatia
    Beans
    9

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

    Quote Originally Posted by bodhi.zazen View Post
    Here is a link to a site with a script to update your hosts file:

    hostsfile.mine
    here is my host file if you wish to block porn

    http://datasaver.orgfree.com/hosts.zip
    xthosts no longer works so I had 2 change!
    Last edited by ipernar; September 27th, 2010 at 04:20 PM.

  2. #12
    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 ipernar View Post
    here is my host file if you wish to block porn

    http://user.xthost.info/zelenalista/hosts.zip
    thank you !!

    The zip file does not download =(
    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

  3. #13
    Join Date
    Feb 2010
    Location
    Zagreb/Croatia
    Beans
    9

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

    Quote Originally Posted by bodhi.zazen View Post
    thank you !!

    The zip file does not download =(
    Dude it must download
    just click download (2times) after clicking the link

    One friend of mine was at my apartment (slept over) and he wanted to search for porn on my comp and was shocked to realise he cant get it... hahah

    It was funny to see his face, i said... wazap bro... no porn today... and he said... yeah dude, i searched...but couldnt get into site...

    email me if yoou want me to send it via email
    ipernar@yahoo.com
    Last edited by ipernar; June 10th, 2010 at 08:34 AM.

  4. #14
    Join Date
    Jun 2006
    Beans
    106
    Distro
    Ubuntu 11.04 Natty Narwhal

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

    Quote Originally Posted by bodhi.zazen View Post
    Optional
    127.0.0.1 = your computer
    0.0.0.0 = nowhere

    "0.0.0.0" is faster as "127.0.0.1" will wait for a timeout


    This command will change 127.0.0.1 to 0.0.0.0 :
    Code:
    sudo sed -i -e 's_127.0.0.1_0.0.0.0_g' /etc/hosts
    WARNING: We now need to manually edit /etc/hosts and change the line(s) at the top with localhost and your hostname back to 127.0.0.1 localhost
    1st off, great suggestion! Thanks

    2nd I would not do it this way.
    What I would do is apply the 127.0.0.1 -> 0.0.0.0 on the mvp file.

    Workflow:
    download mvp file
    apply the mentioned sed to it
    then take a hosts.base and concat the mvp file to it and write it out to /etc/hosts

  5. #15
    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 ipernar View Post
    Dude it must download
    just click download (2times) after clicking the link

    One friend of mine was at my apartment (slept over) and he wanted to search for porn on my comp and was shocked to realise he cant get it... hahah

    It was funny to see his face, i said... wazap bro... no porn today... and he said... yeah dude, i searched...but couldnt get into site...

    email me if yoou want me to send it via email
    ipernar@yahoo.com
    Had to allow cookies to DL the zip file.

    OMG that is one huge hosts file, lol
    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

  6. #16
    Join Date
    Aug 2010
    Beans
    5

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

    Looking at the hosts updatehosts.sh script from

    http://hostsfile.mine.nu/downloads/updatehosts.sh.txt

    There could be a possible bug with the sanity test on line 54.

    if [ 'grep -c "banner" /tmp/hosts' ];then

    Did the author accidently put quotes around the grep, instead of using
    backticks? Perhaps it could have been written like this instead...

    if [ $( grep -c "banner" /tmp/hosts ) ] ; then

    That said, the script works perfectly, so thanks






  7. #17
    Join Date
    Aug 2010
    Beans
    407
    Distro
    Ubuntu 10.04 Lucid Lynx

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

    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".
    Last edited by rocksockdoc; October 2nd, 2010 at 08:29 AM.

  8. #18
    Join Date
    Mar 2011
    Beans
    1

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

    Hi, I'm a first time Ubuntu user (aka Super Beginner) - This is my first post and I realize this is an old thread but I needed some help with the script updating my host file:

    I installed tofrodos and when I do the last step - "sudo ./updatehosts.sh" - I get this message:

    -------------------------------------------------------------
    This script will update your Hosts file to the latest version
    Your original Hosts file will be renamed to /etc/hosts.original
    -------------------------------------------------------------

    Checking for required applications...
    ... wget
    ... unzip
    ... dos2unix
    tofrodos (which contains dos2unix) is missing.
    ... grep
    One or more required applications are missing. Aborting now ...
    adam@adam-MT6840:~$

    It says I'm missing tofrodos which contains dos2unix. I've scoured the internet and these forums but I cannot find a solution. Any suggestions??

    Thanks

  9. #19
    Join Date
    Apr 2006
    Location
    Montana
    Beans
    Hidden!
    Distro
    Kubuntu Development Release

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

    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

  10. #20
    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
    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.

Page 2 of 8 FirstFirst 1234 ... 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
  •