Order to resolve the domain in Linux (hosts file or DNS)

Open the file /etc/nsswitch.conf and find the line with hosts:

hosts:          files dns
It lists the services in order of priority, which are used to find the IP address for the domain name. The column files means the use of the /etc/hosts file, and the dns means use of the Domain Name Service.
If files are located before dns, this means that the system will first try to find the domain in /etc/hosts, and only then by DNS.