If your DNS config is broken, sudo will insert long pauses while it tries to do (often) unnecessary lookups for every command. Even "sudo ls" or "sudo whoami" will make a network call. This is because sudo is designed to support multiple different machine configurations from a single sudoers file, so knowing on which machine sudo is being run is important.

Many home users, however, just have one unique sudoers file per device, and when trying to fix your DNS, the timeouts can be a real problem.

So run visudo and put this in the sudoers file:

Define !fqdn

Save the file and sudo will not waste your time waiting for DNS lookups to timeout anymore.

@xenotrope today i learned there are remote sudoers files
@xenotrope That sounds a lot better than adding yourself to /etc/hosts and maybe fiddling with nsswitch.conf to make sure files is first.
@xenotrope neat trick, but I never had that issue in 30 years of unixing, so this must be a rare cluster event?
@I You've never had a DNS problem on 30 years? That sounds miraculous.
@xenotrope never one that got my sudo hanging. unless maybe it depended on YP, if that is still a thing.