Open In App

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

Last Updated : 28 Apr, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

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

Prerequisite – How to Show Hidden Files and Folders in Windows 10 

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

Steps for Editing the Hosts File on Windows - step 1

 

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

Steps for Editing the Hosts File on Windows - step 2

 

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

Steps for Editing the Hosts File on Windows - step 3

 

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

Steps for Editing the Hosts File on Windows - step 4

 

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

Steps for Editing the Hosts File on Windows - step 5

 

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.

Steps for Editing the Hosts File on Windows - step 6

 

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

Steps for Editing the Hosts File on Mac - step 1

 

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.

Steps for Editing the Hosts File on Mac - step 2

 

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

Steps for Editing the Hosts File on Linux - step 1

 

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.

Steps for Editing the Hosts File on Linux - step 2

 

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


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads