“/etc/nsswitch.conf” file is read by the Name Service Switch (NSS) library when the system starts up. The NSS library then uses the information in “/etc/nsswitch.conf” to determine which name service providers should be used for each type of lookup. “/etc/nsswitch.conf” is a critical part of the Linux operating system, and any changes to the file can potentially cause serious problems. As such, it is important to understand how “/etc/nsswitch.conf” works before making any changes to the file. You can view the content of the “/etc/nsswitch.conf” file using the following command.

Understand the use of /etc/nsswitch.conf with an example

Let’s understand the uses of /etc/nsswitch.conf with an example. In this file, you will find an entry like the below: The above entry tells the order to resolving any domain name. First, the system will check domain mapping in files (/etc/hosts), If a matching entry is found it will use it, else the system will check with the DNS servers. Any domain resolve request will go to the DNS server, only if no matching entry is found in the /etc/hosts file.