Syntax of the Linux hosts File
The syntax of the Linux hosts file isn't sophisticated. The format for the hosts file is the same on Linux/UNIX and Windows and it is as follows:
[IP address] [domain name] [alias]
Therefore, if you want to add localhost, here is how the entry will look like:
127.0.0.0 www.mysite.com localhost
It is important to note that /,\, and http:// are omitted. Otherwise, there is nothing special about the syntax of the entries in the Linux hosts file.
If you want to temporarily exclude some entries without deleting them forever, you can comment them out. The sign # is used for that.
The syntax of the Linux hosts file is pretty simple and for a small number of entries, you can use a conventional text editor. However, when you have many entries to input, then automated tools are what you need because they not only speed the process but also reduce the amount of errors.