Computer, Internet, iOS, Android, Smart Phones,
Microsoft Windows, MAC, Linux Tutorials, Tips and Guides

How to Update Hosts File of Operating System

0

The hosts file is a plain text file in computer used by operating system to map hostnames to IP addresses. It has no file extension and is named as ‘hosts’. Generally speaking we can block, unblock websites access or redirect websites by using hosts file of computer. Different operating systems have different location for this file. Its a system file and is protected. To make changes in the hosts file, you need administrative level access, rights and privileges.

Location of Hosts File

Windows

Type the following

%SystemRoot%\system32\drivers\etc\hosts

in run command and hosts file will be opened in your favorite file editor.

To browse location of hosts file type

%SystemRoot%\system32\drivers\etc\

in run command and the folder containing hosts file will be opened.

It is in location of C > Windows > system32 > drivers > etc

Apple MAC

/private/etc/hosts

Linux

/private/etc/hosts

How to Edit Hosts File

Hosts file is locked and protected. In Windows, browse to the location of file, right click hosts file and click properties. Select security and edit its permissions from there. Give full control to your user over hosts file. After that open hosts file in your favorite text editor and edit/update it as you like.

How to Update Hosts File for iOS Update

In order to update iOS on your device, if you are using your PC and iTunes to update iOS, make sure the hosts file does not contain gs.apple.com server entry. If it is there, add # in the beginning of it. This # will comment that line. Alternatively delete that line if present.

For MAC edit it as following:

In the Finder, choose Applications > Utilities. Open Terminal. Enter the following command and press Return:

sudo nano /private/etc/hosts

Enter the password you use to sign in to your computer and press Return. Terminal will display the hosts file. Navigate using the arrow keys and look for an entry containing gs.apple.com. Add the # symbol and a space (“# “) to the beginning of the gs.apple.com entry. Press Control-O to save the file. Press Enter when asked for the filename and Control-X to exit the editor. Restart your computer.

MAC HOSTS File – Official Link

For Windows you can reset the HOSTS file to default by Microsoft Fix it utility.

Reset HOSTS file to default – Microsoft Fixit.

If you want to reset the Windows HOSTS file yourself, here are default contents for HOSTS file in Windows.

Windows 8 Default HOSTS File

# Copyright (c) 1993-2006 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host
# localhost name resolution is handle within DNS itself.
#       127.0.0.1       localhost
#       ::1             localhost

Windows 7 Default HOSTS File

# Copyright (c) 1993-2006 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host
 
# localhost name resolution is handle within DNS itself.
#       127.0.0.1       localhost
#       ::1             localhost

Windows Vista Default HOSTS File

# Copyright (c) 1993-2006 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host
 
127.0.0.1       localhost
::1             localhost

Windows XP Default HOSTS File

# Copyright (c) 1993-1999 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host
 
127.0.0.1       localhost

Windows HOSTS File – Official Link

[Note: After you are done with the changes in hosts file, change its access level or file permission as it can be attacked by malware, adware, virus or malicious software to redirect traffic from the intended destination to sites hosting malicious or unwanted content.]

Similar Tips

About Author

The CEO of tipsNinja at your service. I spend quite enough time with computers and smart devices. I learn everyday and I like to share what I learn. You can subscribe to updates or receive updates in your email. If you have any question, or tipsNinja could not help you in any way, please ask it in Questions/Answers section.

Leave A Reply

css.php