Press "Enter" to skip to content

Posts published in “Commands”

5 Dig command examples

Dig command (domain information groper) is a built-in command that you can find in any macOS computer and most Linux distros. You can use it to perform a quick check related to your DNS. See individual DNS records or check a name server from the Terminal app with a simple 1 line command. 

It might not have a graphical interface, but you will get all you need in its output.

Here you have 5 dig command examples that will show you how to use it and how the answers look. 

How does Dig command work?

Get the A or AAAA record of a domain name.

dig domainname.com

This command will show you the A record or the AAAA record, or both for the domain you are probing. The first will show you the IPv4 address of the domain name, the second IPv6. 

Get all of the available DNS records.

dig domainname.com ANY +noall +answer

Sometimes you want to see a list of all of the available DNS records, including A, NS, MX, TXT, AAAA, CNAME SOA, and PTR records. That way, you can get a lot of information about the zone, name server, and individual records. Later you can check a particular record or server.

+noall +answer will reduce the answer to just the answer section. 

Get information about the name servers for a particular domain. 

dig domainname.com NS +short

You will get an answer with all the name servers (NS records). Later you can use “dig @nameserver…” to perform additional probes for a particular NS server. 

Get the MX records for the domain name. 

dig domainname.com MX 

You can see the MX (mail exchanger) records for the hostname. From them, you will see which are the incoming mail servers. Not having MX records will be a problem for receiving emails. The senders won’t be able to find which of your mail servers are responsible for receiving the messages, and the delivery will fail. 

Get the TXT records for the domain name.

dig domainname.com TXT

By performing this command, you will see all the TXT records. The common TXT records are SPF, DKIM, and DMARC. All of them are used in email for verification and authentication. They increase the security during the transfer of emails and check if the sender is really the one it says it is. You can check the TXT records for your domain and see if they are properly configured. If you have made errors, you might not be able to send and receive emails or both. 

Get familiar with these examples and try to improvise by changing some of the parameters for your personal needs. 

The hostname could be changed with its IP address; You can probe each individual type of DNS record and more. 

Dig command can also show you the route of the query or answer reverse lookups. 

Why should you use the dig command?

Because it is already on your computer and it can give you enough information about your DNS. It works fast and has a few options to get the right answers. 

Dig is ideal for quick checks. 

5 Incredible Ping command Examples

Today we will explore the Ping command. First, we will explain its definition and how you can use it. Finally, we will discover the five most popular Ping commands. Let’s start.

Definition of the Ping command

One of the built-in network diagnostic commands in your operating system is the Ping command (Windows, Linux, macOS, FreeBSD, etc.). Ping is used to test connectivity between your device and the target, which can be an IP address like 188.114.97.7 or a hostname like google.com.

By default, Ping uses the ICMP protocol to send the target four messages, each containing 32 bytes (Internet control message protocol).

Brief History of Ping command

How can you use it?

You can use the command on Windows devices in one of two ways: through the Command Prompt or using Windows PowerShell.

And if you are using Linux or macOS Operating systems, you may use it through the Terminal application.

5 examples of Ping command

  • The basic Ping command allows you to check your connectivity and the capability of the computer you are testing. As a result, on Linux or macOS, you will constantly hear a ping. Use the Ctrl-C combo to stop it. If there are no problems, you will get four replies and statistics for Windows.

ping example.com

  • On Windows, you should add the extra option “-t” for continuous ping. Fill in the following:

ping -t example.com

  • For a specific quantity of inquiries. You are allowed to make a custom number of queries on macOS and Linux and more than four requests on Windows.

For Linux and Mac

ping –c 8 example.com

in Windows

ping –n 8 example.com

  • The space in between pings. You can calculate the time in seconds between requests.

Linux/macOS

ping -i 20 1.2.3.4

  • Waiting period. It can be set to stop the ping command on macOS/Linux in seconds.

ping –w 50 example.com

Conclusion

So, the Ping command is a fundamental tool for network device testing. It is available on almost every OS and functions nearly identically on each one. ICMP packets should be sent, and the duration of the echo-response should be timed. Simple and ideal.

How to use NSlookup commands

NSlookup is a built-in software that allows you to query domain name servers.

NSlookup commands can be used on most typical OSes like Windows, macOS, and Linux (Ubuntu, CentOS, Debian, etc.). Now you will see what is it, and how to you it?

How to start the NSlookup command?

For Windows

1. Press Windows key + the letter “R”. This will start the run application.

2. Write “cmd” and press “ok”.

3. Now, you are ready to use NSlookup command. See the examples below.

For macOS

1. Press the command button + Spacebar button.

2. Type the name of the app – Terminal.

3. Ready to write NSlookup commands.

Nslookup: command not found – how to fix it?

Examples of how to use Nslookup commands:

Use these examples with the domain you like by changing the domainname.com with the one you like. The same goes for the IP addresses used in the examples. 

Use the NSlookup to see the domain’s IP address:

nslookup domainname.com

This will show you the data from the A and AAAA records of the domain. There you can see the IPv4 and IPv6 addresses.

Check specific DNS type of record with the following:

nslookup -type=TYPE domainname.com 

You can change TYPE with the type of DNS record you want to query like: A, AAAA, MX, SOA, NS, ANY (any type available). 

nslookup -type=a domainname.com – shows you the IPv4 addresses of the domain.

nslookup -type=aaaa domainname.com – shows you the IPv6 addresses of the domain. 

nslookup -type=mx domainname.com – shows you the MX records, and you can see the responsible email servers for receiving emails. 

nslookup -type=soa domainname.com – shows you the start of authority. 

nslookup -type=ns domainname.com – shows you the name servers available. 

nslookup -type=any domainname.com – shows you all of the DNS records available. 

Check a specific name server.

After you have seen all of them with the NS query, you can now probe each individually. 

nslookup domainname.com ns1.domainname.com

Change ns1.domainname.com with one of the name servers for your domain. 

Check an IP address (Reverse DNS lookup)

You can also probe an IP address and see if there is a PTR record set in a Reverse DNS zone. 

nslookup 111.111.111.111

Change the 111.111.111.111 IP address with the one you want to verify. It can be IPv4 or IPv6 address. 

Learn more about rDNS

Nslookup check of a particular port for communication.

You can also use the NSlookup to check a server through a particular port. In this case, we will use port 53. Change it with another if you like. 

nslookup -port=53 domainname.com

Give a particular time limit to wait for the response.

You can set the waiting period, in seconds, for the queries. Let’s set it to 35 seconds in this example. You can set it to another period. 

Nslookup -timeout=20 domainname.com

Nslookup debug mode enable 

nslookup -debug domainname.com

Conclusion

The NSlookup command is a very used tool because it is easy to find on different devices and works the same. It doesn’t have so much different behavior on the different Oses like some other network tools. 

The Nslookup command can help you check your domain name and see problems with your DNS.

What is the MTR command, and how to use it?

What is the MTR command?

MTR command is a type of traceroute command developed by Matt Kimball in 1997 that allows both traceroute and ping in the same software. Originally the name MTR was an abbreviation of Matt’s traceroute, but in 1998, his colleague Roger Wolff worked on it too and changed the name to My traceroute.

Why is the MTR command better than the traditional Traceroute or Tracert?

The MTR command is better because it combines the Ping and the Traceroute command and gives additional information (statistics about time, packet loss, and round-trip time, too) about each hop on the way from the computer to the host.

MTR will send ICMP ECHOs (pings) and wait for them to return.

How can you get the MTR command?

To get it, you will need a few commands to download it and install it. You can do it on Ubuntu, other Linux distros, macOS, or BSD and its derivates. Sorry, but the command is not available on Windows.

Ubuntu

  1. Log in to your server, or start the Terminal application
  2. Write the command:

sudo apt update

this will update the list of all packages available

  1. Install with the following command:

sudo apt -y install mtr

macOS

  1. Open the Terminal app
  2. Install first the Homebrew with the following command:

/bin/bash -c “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)”

  1. Now, you can install the MTR command with:

brew install mtr

BSD

  1. Log into your server, or start the Terminal application
  2. Use the following command

pkg install mtr

You can install the MTR command on most Linux distros like Arch Linux, CentOS, Fedora, RedHat, Debian, and more.

Suggested article: What is Traceroute command and how to use it?

How to use the MTR command?

You can use it through the Terminal application. You have two basic ways to use the MTR command:

mtr + hostname – This one will show you the route to a particular hostname / domain name.

mtr +IP address – This will trace the route to a particular IP address. It could be IPv4 or IPv6 address.

The MTR syntax

mtr [-hvrctglspni46] [–help] [–version] [–report] [–report-cycles COUNT] [–curses] [–split] [–raw] [–no-dns] [–gtk] [–address IP.ADD.RE.SS [–interval SECONDS] [–psize BYTES | -s BYTES] HOSTNAME [PACKETSIZE]

But to see it more clearly, imagine it like this:

mtr OPTION OPTION’S VALUE hostname / IP address

  • mtr – my traceroute command.
  • OPTION – additional option for more precise probes. You can see the table below.
  • OPTION’S VALUE – sets the time or repetition. It depends on the option you have chosen. 
  • Hostname / IP address – You can put one of the two to trace the route to it.

We recommend you to read also about NSlookup command and DIg command

MTR command’s options

-h-helpHelp
-v-versionMTR’s version
-r-reportReport mode needs -c to specific the cycles before showing statistics at the end.
-w-report-wideExtended report mode.  
-c COUNT–report-cycles COUNTThe number of pings that must be sent.
-s BYTES–psize BYTES PACKETSIZEChoose the size of packets. If you chose a negative value, they would have a random size. 
-t–cursesCurses-based terminal interface
-n–no-dnsShow IP address, don’t resolve the hostname.
-g–gtkGTK+ interface.
-p–splitSplit-user interface.
-l–rawRaw output format. 
-a IP.ADD.RE.SS–address IP.ADD.RE.SSLink packets’ sockets to a specific interface
-i SECONDS–interval SECONDSSeconds between pings.
-u Use UDP.
-4IPv4 address only.
-6IPv6 address only.

The MTR command is a nifty tool for network diagnostic. Try it out!