[email protected]Support 24/7 · Billing 09:00 – 00:00LinkedInXFacebook
NexonHost
Netherlands Dedicated ServersAmsterdam · Equinix AM6Germany Dedicated ServersFrankfurt · Equinix FR4Romania Dedicated ServersBucharest · VoxilityAustria Dedicated ServersVienna · Interxion VIEBulgaria Dedicated ServersSofia · TelepointFrance Dedicated ServersParis · Interxion PAR — Marseille · Digital Realty MRS3Ireland Dedicated ServersDublin · Equinix DB2Italy Dedicated ServersMilan · Irideos AvalonPoland Dedicated ServersWarsawSpain Dedicated ServersMadrid · Equinix MD2United States Dedicated ServersAshburn · Equinix DC
All articles
Getting startedSeptember 7, 2023

How to Edit Your Hosts File on Linux, Windows, and macOS.

How To Edit Your Hosts File On Linux, Windows, And MacOS.

In this article, we’ll provide instructions about how to modify the hosts file on Linux, macOS, and Windows.

The hosts file is used to map domain names (hostnames) to IP addresses. It is a plain-text file used by all operating systems including, Linux, Windows, and macOS.

 

Hosts File Format

Entries in the hosts file have the following format:

IPAddress DomainName [DomainAliases]

The IP address and the domain names should be separated by at least one space or tab. The lines starting with # are comments and are ignored.

To add an entry to the hosts file, simply open the file in your text editor. Below is a sample hosts file:

# Static table lookup for hostnames.
# See hosts(5) for details.

XX.XX.XX.XX nexonhost.desktop nexonhost
XX.XX.XX.XX localhost

The hosts file changes take effect immediately except in cases where the DNS entries are cached by applications.

To undo the changes, simply open the file and remove the lines you added.

 

Modify Hosts File in Linux

On Linux, the full path to the file is /etc/hosts.

The instructions below are valid for all Linux distribution, including Ubuntu, CentOS, RHEL, Debian, and Linux Mint:

  1. In your terminal window, open the hosts file using your favorite text editor :

    sudo nano /etc/hosts

    When prompted, enter your sudo password.

  2. Scroll down to the end of the file and add your new entries:

  3. Save the changes.

 

Modify Hosts File in Windows

On Windows, the full path to the file is c:\Windows\System32\Drivers\etc\hosts. The instructions below are valid for Windows 10 and Windows 8.

  1. Press the Windows key and type Notepad in the search field.

  2. Right-click on the Notepad icon and select Run as administrator.

  3. In Notepad, click File then Open. In the File name field, paste c:\Windows\System32\drivers\etc\hosts.

  4. Scroll down to the end of the file and add your new entries:

  1. Save the changes by clicking File > Save.

 

Modify Hosts File in macOS

On macOS, the full path to the file is /etc/hosts. The instructions below are valid for all macOS versions.

  1. In your terminal window, open the hosts file using your favorite text editor:

    sudo nano /etc/hosts

    When prompted, enter your administrative password.

  2. Scroll down to the end of the file and add your new entries:

  1. Save the changes and flush the DNS cache:

    dscacheutil -flushcache

 

Conclusion

The hosts file allows you to set the IP address of a given domain name.

Keep reading
How to use shortcuts for screen command.
July 24, 2023

How to use shortcuts for screen command.

How To Use Shortcuts For Screen Command. What is screen comand? At its core, screen is a terminal multiplexer. It enables users to open multiple virtual terminals within a single physical terminal or remotely accessed terminal. With screen, you can start long-running processes, keep them running…

Read article
How to set up LACP bonding with Netplan
July 24, 2023

How to set up LACP bonding with Netplan

How to set up LACP bonding with Netplan Step 1 – Login using SSH Step 2 – Install the ifenslave dependency sudo apt-get install ifenslave Step 3: Load bonding kernel module Before you can configure the network cards you need to ensure that the kernel module called bonding is present and loaded.…

Read article
How to use Python if..else statement.
July 24, 2023

How to use Python if..else statement.

How To Use Python If..Else Statement. Python if Statement The most basic form of the if statement in Python is as follows: if EXPRESSION: STATEMENT The if statement starts with the if keyword followed by the conditional expression. The EXPRESSION must be followed by (:) colon. If the EXPRESSION…

Read article
Get in Touch

Together, Let’s Build a Faster, Safer Internet.

Build scalable infrastructure with NexonHost — high-performance dedicated servers, VPS hosting, cloud hosting, and DDoS protection across Europe.

Get Started →Contact Us
[email protected]Support 24/7 · Billing 09:00 – 00:00