Host file is used to bypass the DNS and connect to the Internet based on the user defined rules. If you want to have your own set of rules and bypass the DNS then you need to edit the host file. Editing hosting file is little different from editing the normal file because, Editing the host file needs administrator privileges in operating system. Here in this post you learn how you can edit the host file easily in Windows and Linux.
Editing Host file in Windows 8 [Without Tool / Traditional way]
As to edit the Host file we need to run the text editor with Administrator privileges. You can use any text editor like notepad, notepad++,wordpad or any other your favorite text editor (Don’t forget to share with us) to edit the host all you need is just to run your text editor application with Administrator privileges. Running the applications with Administrator privileges on Windows 8 is so easy.There are multiple ways to run an application with administrator privileges, Here we have choose the best and easy way to run the applications.
1) Running the Text Editor with Administrator Privileges
Step 1: Search for the App/Program as shown in below image
Step 2:- Now right click on the text editor, Here for this tutorial we are using Notepad to edit the host file so we selected it.You also just tap or click(left click) on the application by holding down the shift and ctrl key together.
Step 3: Now click on Run as Administrator as shown.If you are account does not have administrator privileges you need to enter the administrator password to complete the action.
That’s it now you have completed running your text editor with administrator privileges.
2) Editing the Host file
The host file in windows is located at location specified below
Navigate to the specified location and select the file to open as shown in below image.(Don’t forget to change the type of file from .txt to All files to show the host files.
That’s it now you are done. You can edit the host file and save the file.
If you don’t want to follow these steps then you can get host file editor from here. It has awesome and simple user interface with nice features. You will surely love this tool. If you frequently edit the host files.The only thing that hurts is it needs .NET framework!..Which making this unfit for running the this program easily on other computers.
I found a better alternative for this from the Wingix software (Running Ngnix on local server) which can be run on any computer without any dependency on other programs. You can get this file from here (Hosted on my DropBox account)
Editing host file in Linux
Editing the host file on Linux also needs the administrator privileges. And the host files are stored in /etc/hosts folder as same in Windows You can use any text editor to edit. Here we are using the gedit editor to edit the host file because I like the gedit editor.So here is the command for it.
sudo gedit /etc/hosts
for vi editor
sudo vi /etc/hosts
If you are not having administrator privileges on your account then you are promoted to enter the password to continue.As shown in the image
Here as I used gedit editor to edit the host file on my ubutnu computer.
I use Host files mainly for the forced DNS propagation, and blocking unwanted sites on my laptop.
You might also Like to read:-