How to Edit Your Hosts File on Windows, Mac, or Linux

Oftentimes, it becomes a necessary task to edit the host file in Windows, Mac, and Linux operating systems. The host file might be changed by some malicious attack on your machine or sometimes you need to get control access to some websites, then you should make some changes in the host file. In this article, we will go through some easy steps that will help to edit Mac, Linux, and Windows host files.

Steps for Editing the Hosts File on Windows

Step 1: Open the Windows Explorer in the machine & browse to the Drive C & click on the Windows folder.

 

Step 2: Now search for the folder System32 & double-click on it to open.

 

Step 3: Inside that System32 folder, search for the folder Driver & double-click over it to open.

 

Step 4: Inside that Driver folder, find out the folder Etc & again open it to access its files.

 

Step 5: Now, double-click over the Hosts file to open it in the default application NotePad.

 

Step 6: Now, the Host file is ready to make changes. After making the changes, press the Ctrl + S Button simultaneously to save the changes into the device.

 

Hence, we have successfully edited the host file Windows operating system.

Steps for Editing the Hosts File on Mac

Step 1: Open the Terminal of the Mac operating system & execute the following command. 

*Note: You may also be asked to enter the MacBook password.

Command: sudo nano /etc/hosts

 

Step 2: A new editor will be opened in the next window which allows user to make any changes. The IP Address along with the Domain Name will be inserted into the editor. Right after that, click Enter to save the changes.

 

Hence, we have successfully edited the host file in the Mac operating system.

Steps for Editing the Hosts File on Linux

Step 1: Open the Terminal in the Linux operating system & run the following command. 

*Note: You may also be asked to enter the password before you run the command.

Command: sudo nano /etc/hosts

 

Step 2: A new editor will open, now enter the IP Address along with the Domain Name in the editor. After making the changes, press Enter or F9 to save the data into the host file.

 

By applying this, 2-step procedure, we can easily host file in the Linux Operating System.