The hosts file is a way to map hostnames to IP addresses. This is very important with certain setups and to make networking on Linux a bit easier. In a sense, the hosts file acts as a local DNS server.
sudo nano /etc/hosts
For example, to block Wikipedia, you’d type (remembering to use the Tab key rather than Space):
127.0.0.1 wikipedia.org
or static dns lookup for hostnames
198.20.14.51 example.com
References
https://www.makeuseof.com/tag/modify-manage-hosts-file-linux/