Learn practical Linux commands for DNS and website troubleshooting including dig, host, nslookup, curl, ping, traceroute and grep.

Quick wins from this guide
  • Troubleshoot DNS and hosting issues faster
  • Check records, routes, web responses and logs
  • Build practical command line confidence

DNS commands

Start with dig, host and nslookup. Use them to check A, AAAA, MX, TXT, CNAME and NS records. Query different resolvers when results look inconsistent.

Website response checks

Use curl -I https://example.com to check headers, redirects and HTTP status codes. Use curl -v for more detail. This helps confirm whether DNS reaches the right server and whether the web layer responds correctly.

Network path checks

Use ping carefully because some hosts block ICMP. Use traceroute or tracepath when checking path issues. These tools do not replace DNS lookups, but they help confirm where traffic is trying to go.

Log and file checks

On servers, DNS may only be the first clue. Use grep to search logs, tail -f to watch live requests and ss -tulpn to check listening services. You can practise these skills on CommandLineQuiz, including the Bash Scripting Hub and command quizzes.

Quick commands to try

dig example.com A
dig example.com MX +short
host -t TXT example.com

Practise the command line side

DNSNow gives you quick web checks. For hands-on Linux command practice, use CommandLineQuiz dig Command Builder, the Linux Troubleshooting Hub and the Bash Scripting Hub.

FAQs

What Linux command checks DNS records?

dig is the most flexible DNS lookup command. host and nslookup are also commonly used.

What command checks website headers?

curl -I https://example.com checks HTTP response headers and status codes.

Do DNS commands prove the website is working?

No. DNS can point to the right server while the web server, SSL certificate or application still has a problem.

Sources and further reading