Linux is a very powerful operating system and also one of the most flexible operating systems on the market. That flexibility has always been a big selling point of the OS. Users who don’t like how Linux works can bend it to their needs.
One very simple example of this is the Linux hosts file. Please understand that the hosts file is not specific to Linux only. Windows and MacOS also use hosts files. In fact, MacOS hosts files are almost identical to Linux hosts files.
What is a hosts file?
A hosts file makes it easy to map IP addresses to domain names. Sound familiar? Because that’s exactly what DNS does today. But in the days of ARPANET, there was no DNS, so we needed a way to map these addresses. This is where the hosts file comes into play. Given that DNS takes care of that, why do we need a hosts file?
The best example I can give is a LAN-based network setup with servers or desktops that you want to be able to access without having to enter the full IP address. You may have a server on your LAN that you access regularly.
You can map that IP address to your hosts file by simply typing:
It’s not less typing, but it certainly means you don’t have to remember that server’s IP address. Use nicknames instead. This is very useful when working with many servers on a LAN. You can also use these nicknames in your web browser. For example, if you installed his Invoiceplan (an invoicing solution) on a server in your LAN, and the document root for that service is /var/www/html/invoiceplane, you can use the server’s IP address as the nickname for Invoice and your browser’s address Type “invoice/invoiceplane” in the bar to open the service.
How to configure the Linux hosts file
How do you set this up? It’s very simple. Let me show you how.
All you need is a running instance of Linux and a few IP addresses to map. That’s all. Make some hosts magical.
If you’re new to Linux, you probably don’t need to worry about the hosts file at first. Ultimately, though, the deeper you get into using Linux, the more likely you are to encounter many situations where a hosts file is very necessary.
https://www.zdnet.com/article/how-to-set-up-linux-hosts-file/#ftag=RSSbaffb68 How to set up a Linux hosts file