<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Safal Bhattarai</title>
    <description>The latest articles on DEV Community by Safal Bhattarai (@coder-safal).</description>
    <link>https://dev.to/coder-safal</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3112491%2Fbdc68e36-d277-4270-a3c5-c19903276f3f.jpg</url>
      <title>DEV Community: Safal Bhattarai</title>
      <link>https://dev.to/coder-safal</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/coder-safal"/>
    <language>en</language>
    <item>
      <title>Linux dig Command: Simple DNS Lookup Examples</title>
      <dc:creator>Safal Bhattarai</dc:creator>
      <pubDate>Tue, 27 Oct 2026 15:44:54 +0000</pubDate>
      <link>https://dev.to/coder-safal/linux-dig-command-5-examples-every-developer-should-know-3bo9</link>
      <guid>https://dev.to/coder-safal/linux-dig-command-5-examples-every-developer-should-know-3bo9</guid>
      <description>&lt;p&gt;The &lt;code&gt;dig&lt;/code&gt; (Domain Information Groper) command helps developers check DNS records and troubleshoot domain resolution on Linux. It is one of the first tools to reach for when a domain isn't behaving the way you expect.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Install dig
&lt;/h2&gt;

&lt;p&gt;On Debian/Ubuntu-based systems, &lt;code&gt;dig&lt;/code&gt; ships in the &lt;code&gt;dnsutils&lt;/code&gt; package:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;sudo &lt;/span&gt;apt update
&lt;span class="nb"&gt;sudo &lt;/span&gt;apt &lt;span class="nb"&gt;install &lt;/span&gt;dnsutils
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  2. Find a Domain's IP Address
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;dig safal.me +short
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;+short&lt;/code&gt; flag trims the output down to just the IP addresses found in the DNS response.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Check DNS Records
&lt;/h2&gt;

&lt;p&gt;Pass a record type after the domain name:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;dig safal.me A
dig safal.me AAAA
dig safal.me MX
dig safal.me NS
dig safal.me TXT
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Record&lt;/th&gt;
&lt;th&gt;Purpose&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;A&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;IPv4 address&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;AAAA&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;IPv6 address&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;MX&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Mail servers&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;NS&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Name servers&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;TXT&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Text records (SPF, domain verification, etc.)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  4. Query a Specific DNS Server
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;dig @8.8.8.8 safal.me
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This sends the query to Google's public DNS resolver instead of your system default, which is handy for checking whether a problem is local to your resolver.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Trace DNS Resolution
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;dig safal.me +trace
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This shows the delegation process step by step, from the root servers down to the domain's authoritative name servers.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;dig&lt;/code&gt; command is a useful tool for developers and DevOps engineers troubleshooting DNS issues. Once you know these few flags, most DNS debugging becomes quick and predictable.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Next:&lt;/strong&gt; Linux &lt;code&gt;nslookup&lt;/code&gt; Command: Simple Examples.&lt;/p&gt;




&lt;h2&gt;
  
  
  About Me
&lt;/h2&gt;

&lt;p&gt;I'm &lt;strong&gt;Safal Bhattarai&lt;/strong&gt;, a Tech Lead, Full Stack Developer, and DevOps Engineer.&lt;/p&gt;

&lt;p&gt;🌐 &lt;a href="https://safal.me" rel="noopener noreferrer"&gt;Website&lt;/a&gt; &lt;a href="https://github.com/Coder-safal" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;&lt;/p&gt;

</description>
      <category>linux</category>
      <category>devops</category>
      <category>dns</category>
      <category>networking</category>
    </item>
  </channel>
</rss>
