Results 1 to 6 of 6

Thread: Modifying the /etc/hosts file in Percise Pangolin

  1. #1
    Join Date
    Jan 2014
    Location
    Sojournor
    Beans
    36
    Distro
    Ubuntu 12.04 Precise Pangolin

    Modifying the /etc/hosts file in Percise Pangolin

    I would like to modify my hosts file to block a list of adservers with the 127.0.0.1 address,
    This is what I have done but I have not been sucessfull yet in saving the new file or getting it installed properly
    .
    I typed
    Code:
     
    sudo vi /etc/hosts
        # You'll be prompted for your account password
        # Press the down arrow past any # comments to get to the list of hosts
        i
        # pressing i puts you into insert mode
        # press return and up arrow to create a blank line
        128.117.224.210 www.scd.ucar.edu
        # press the escape key
        :wq! 
        sudo killall -HUP lookupd
    I pressed the escape key and it did not let me escape. and I didnot get the $ to enter the last command " sudo killall

    Any assistance on this issue. I did not see much in the way of this on the board.

  2. #2
    Join Date
    Sep 2010
    Beans
    898

    Re: Modifying the /etc/hosts file in Percise Pangolin

    vi is tricky to use. Why not use an easier one?

    Code:
    sudo nano /etc/hosts
    or

    Code:
    gksudo gedit /etc/hosts

  3. #3
    Join Date
    Feb 2014
    Beans
    6

    Smile Re: Modifying the /etc/hosts file in Percise Pangolin

    Hi there

    I think the problem might be an order of operations thing. Are you copy and pasting that from a post somewhere?

    When you sudo it gives you permission to do things as the super user (root) such as modify system files. The next part of the command is vi which is command line accessible text editor.

    The line saying to press escape means to put vi in command mode and using the :wq command to write the changes and quit the program. The exclamation point isn't really needed.

    An easier way for you to do the changes if you're using the Desktop version is to use:

    Code:
    sudo gedit /etc/hosts
    This will give you a visual editor to use instead in a more familiar environment.

    It might be worthwhile backing up your hosts file before doing the edits using something like

    Code:
    sudo cp /etc/hosts /etc/hosts.`date +%s`.bak
    Best of luck!

  4. #4
    Join Date
    Apr 2011
    Location
    Mystletainn Kick!
    Beans
    13,616
    Distro
    Ubuntu

    Re: Modifying the /etc/hosts file in Percise Pangolin

    gedit automatically creates a backup.

    If you hit save once the original gets moved to a hidden file called /etc/hosts~.
    If you hit save again, then that newly made backup is overwritten.

    So if you only hit save once, you'll have a backup.

    To see the backup in Files(nautilus) press ctrl+h to view hidden files.
    Splat Double Splat Triple Splat
    Earn Your Keep
    Don't mind me, I'm only passing through.
    Once in a blue moon, I'm actually helpful
    .

  5. #5
    Join Date
    Jan 2014
    Location
    Sojournor
    Beans
    36
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Modifying the /etc/hosts file in Percise Pangolin

    Thank you for your speedy and informative replies. I am going to test this out right now! Thank you, all.

  6. #6
    Join Date
    Jan 2014
    Location
    Sojournor
    Beans
    36
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Modifying the /etc/hosts file in Percise Pangolin

    Ok, Feedback here, the
    Code:
     
    gksudo gedit /etc/hosts
    worked. I was able to cut and paste the list into the file. I did have one question though, When I tried to save it asked Where to put the file and I didn't know. But I checked by using
    Code:
    gksudd gedit /etc/hosts
    and the amended file was in place.

Tags for this Thread

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
  •