India English
Kenya English
United Kingdom English
South Africa English
Nigeria English
United States English
United States Español
Indonesia English
Bangladesh English
Egypt العربية
Tanzania English
Ethiopia English
Uganda English
Congo - Kinshasa English
Ghana English
Côte d’Ivoire English
Zambia English
Cameroon English
Rwanda English
Germany Deutsch
France Français
Spain Català
Spain Español
Italy Italiano
Russia Русский
Japan English
Brazil Português
Brazil Português
Mexico Español
Philippines English
Pakistan English
Turkey Türkçe
Vietnam English
Thailand English
South Korea English
Australia English
China 中文
Somalia English
Canada English
Canada Français
Netherlands Nederlands

DNS commands

And now, here are the commands. To use them, open your terminal on Linux/Mac or command line in Windows.

  1. Ping

This is by far the most common command used to quickly check for reachability of an IP. You can ping an IP, domain name, host name or even name server.

Usage: On Linux/Mac, open Terminal and type as follows:

[user@hostname ~]$ ping -c 4

[user@hostname ~]$ ping -c 4

[user@hostname ~]$ ping -c 4

Note: You need to specify how many ping test should be run before ping stops. Otherwise you will need to manually stop the ping process by typing Ctrl+Z as it will continually ping

On windows open Command Line and type:




Other than checking the reachability of an IP, the ping command also displayed the IP address of the domain name or name server.

  1. Nslookup

This one is used to query the IP address, name servers and host name. If used to query a domain name or host name, it will provide an IP address for as a result if the domain name/host name is valid and reachable. If used to query an IP, it will provide the host name, PTR and name servers for the server owning the IP.

  1. traceroute / tracert

This one shows the path taken by a packet from your computer to the server. Typically, it displays the route taken by a packet to reach destination.

Usage: On Linux/Mac, the command is used as traceroute while on Windows, the command is used as tracert. To use, open Terminal and type

[user@hostname ~]$ traceroute

[user@hostname ~]$ traceroute

  1. host

This is probably the most powerful DNS tool available for Linux machines. It is a DNS lookup utility that us used to lookup all types of DNS records. All you’ll need to do is provide the correct option.


  • Get associated IP addresses and MX records for a domain e.g.

    [user@hostname ~]$ host has address mail is handled by 0

  • Use -t ns option to find domain name servers

    [user@hostname ~]$$ host -t ns name server name server

  • Use -t cname option to find the domain cname

    [user@hostname ~]$ host -t cname has no CNAME record

    [user@hostname ~]$host -t cname is an alias for

  • Use -t mx option to find the MX records for a domain

    [user@hostname ~]$ host -t mx mail is handled by 0

  • Use -t txt to find the domains TXT record

    [user@hostname ~]$ host -t txt descriptive text “v=spf1 ip4: +a +mx +ip4: ~all”

  • Use -C option to find the SOA records

    [user@hostname ~]$host -C

    Nameserver has SOA record 2018030514 3600 7200 1209600 86400

    Nameserver has SOA record 2018030514 3600 7200 1209600 86400

  • Query a particular name server

    [user@hostname ~]$host

    Using domain server:



    Aliases: has address mail is handled by 0

Share some Love
× WhatsApp us