Get 69% Off on Cloud Hosting : Claim Your Offer Now!
Editing the hosts report may be useful for numerous functions, including redirecting domain names to specific IP addresses or blocking certain websites. Here’s how you may edit the hosts file on each Windows and Linux working structures.
Open Notepad as Administrator:
Search for "Notepad" in the Start menu.
Right-click on "Notepad" and select "Run as administrator." This is necessary because editing the hosts file requires administrative privileges.
Open the Hosts File:
In Notepad, go to File > Open.
Navigate to C:\Windows\System32\drivers\etc.
Change the file type from "Text Documents (.txt)" to "All Files (.*)".
Select the file named hosts and click Open.
Edit the Hosts File:
Add your desired entries at the end of the file. Each entry should be in the format:
For example:
This example redirects example.com to 127.0.0.1 (localhost).
Save the File:
After making your changes, save the file by going to File > Save.
Flush DNS Cache (if needed):
Open Command Prompt as an administrator.
Run the command:
This clears the DNS cache and applies your changes immediately.
Open a Terminal Window:
You can usually find it in your applications menu or by pressing Ctrl+Alt+T.
Edit the Hosts File Using a Text Editor:
Use a text editor with superuser privileges. For example, with nano:
Or with vim:
Make Your Changes:
Add or modify entries in the file in the format:
For example:
Save and Exit:
In nano, save changes with Ctrl+O, press Enter, and exit with Ctrl+X.
In vim, save and exit with :wq and press Enter.
Flush DNS Cache (if needed):
Linux generally does not cache DNS queries in the same way as Windows. However, if your system uses systemd-resolved, you can restart it to clear the cache:
Permissions: Editing the hosts record requires administrative or superuser permissions. Be cautious whilst making modifications, as incorrect entries can have an effect on your machine’s community conduct.
Backup: It’s a terrific concept to returned up the original hosts report earlier than making modifications. You can copy it to every other place for safekeeping.
If you come across issues or need similarly assistance, your operating system’s guide forums or documentation might also offer additional steerage.
Let’s talk about the future, and make it happen!
By continuing to use and navigate this website, you are agreeing to the use of cookies.
Find out more