How to edit the hosts file in MacOS, Windows and Linux

The hosts file is a text file that maps hostnames to IP addresses. Upon typing a url address on the browser, the system is checking if there is a relevant entry on the hosts file and gets the corresponding IP address, else it resolves the IP via the active connection’s DNS servers. The hosts file can also be edited to block certain hostnames (like ad-serving/malicious hosts), or used for web development purposes, i.e. to redirect domains to local addresses. Editing the hosts file in MacOS Open the Terminal.app Start typing Terminal on the Spotlight, or by going into Applications -> Utilities ->...