Hosts File for Linux or Unix
Linux Hosts counter:
How to use the hosts file to block ads in Linux or Unix:
Linux users can use the same hosts file that Windows users currently enjoy. Many of you may have known this all along, but for those of you who don't, the Windows and Unix/Linux operating systems use the same format for their hosts files.
Background information on hosts files in Linux and Unix environments:
The hosts file in Linux (/etc/hosts) is a simple list of IP addresses and the hostnames that they correspond to. Every hosts file in Linux should have an entry for the IP address "127.0.0.1", with the name "localhost" following it. This is also known as the loopback address. That same file may also have an entry for your system name, unless you did not provide one during installation.
This hosts file in Linux can store your system's name and IP address, and it is important that you do not delete this information from your computer. Deleting this information will damage your networking capabilities, which means that you may not be able to access either your local network or the Internet.
So unlike Windows, you will probably not want to simply copy the ad-blocking hosts file directly over your existing hosts file. Instead, you should follow these directions:
(1.) Download the hosts.zip file from the Get Hosts File page (or click here) and uncompress it. Be sure the Hosts file is extracted or saved as "hosts", without any file extensions, and not as something like "hosts.txt".
(2.) Find the Hosts file in the appropriate directory on your system.
For most Linux, Unix, Solaris, and BSD users, this will be in the /etc directory, and you will need root access to do anything with it. (For BeOS use: /boot/beos/etc/)
If this is not the case on your system, you will need to locate the existing hosts file. If it is completely empty, you can replace it with the ad-blocking file. If it is not empty, which should be the case, you will want to be sure to save any information that is in there and/or make a backup copy of your current hosts file.
If there are currently entries in your existing hosts file, then open the ad-blocking hosts file. Copy the text from it to add to the bottom of any existing text in your current hosts file. This will ensure that your current entries will still work for you, and that you do not corrupt your network properties.
Note: Be sure that your new Hosts file has the same localhost entry (usually found on the first line) as the existing Hosts file on your system, or you could have some problems. I would advise all users to backup their existing files before switching to the new one. Be sure that you transfer all other entries in your existing hosts file into the new file, unless you are sure that you do not need them.
Do not change any other files you may find that have the name "hosts" in them (such as hosts.deny or hosts.allow). You should not need to change them for the ad-blocking to work.
(3.) Try one of these solutions to begin using Hosts, or reboot if necessary:
(1.) Try logging out and logging back in first, which seems to work on a redhat 7.1 test system at GDS.
(2.) Do a "killall -hup inetd" (without the quotes) while having root privileges, which will restart the inetd process and should not require a reboot.
(3.) In redhat, SuSE, and Mandrake, you can try opening a console window and issuing these commands (without quotes):
"telinit 3", to switch from runlevel 5 to runlevel 3
"telinit 5", which will restart many daemones en route to putting you back in runlevel 5 and the GUI
(4.) If none of those work, then you may have to reboot for the file to take effect.
Many thanks to our readers for pointing some of these methods out.
(4.) Consider using eDexterJavaDog.
If you are experiencing browser slowdowns while using the Hosts file, consider using eDexterJavaDog. It works in a similar manner to the Windows version of eDexter. Visit the eDexter page on this site for more information.
Gorilla Design Studio's support for Linux and Unix users is minimal. Most people using those operating systems will be able to figure this out. For those that can not, I will make some efforts to help you, but there are a wider variety of possible Linux and Unix configurations than there are in Windows, which means that it would take too much time to chase everything down for every user. Good luck if you try this, and I hope that it works for you.
Last updated on: April 29th, 2001