What are /etc/hosts, /etc/resolv.conf and /etc/nsswitch.conf?
IntermediateConceptNetworking, SSH & Scheduling
Answer
/etc/hosts: static name to IP map./etc/resolv.conf: DNS servers (nameserver),searchdomains, options likendots,timeout./etc/nsswitch.conf: lookup order, e.g.hosts: files dns.
On systemd-resolved systems /etc/resolv.conf is a symlink to a stub (127.0.0.53); see the real upstreams with resolvectl status. dig reads resolv.conf directly and skips /etc/hosts; getent hosts name follows nsswitch like applications do.
More on Networking, SSH & Scheduling
Which `ip` commands replace ifconfig, route and arp?BeginnerWhat does `ss` show, and which flags do you use?BeginnerExplain the TCP connection states you see in ss.AdvancedWhat happens, step by step, when you run `curl https://example.com`?AdvancedWhich curl flags are most useful for debugging?BeginnerHow do you use `dig` for DNS troubleshooting?Beginner