How to use Linux MTR command?

There are plenty of programs for network diagnostic. You might wonder, do we need one more? 

If you want to trace the route of a query, yes! The MTR command could slightly outperform the traditional traceroute command and give some more data, so it has a reason to exist. 

What is MTR command?

MTR comes from Matt’s traceroute. First written by Matt Kimball in 1997 and later updated with Roger Wolff’s help, this is software with CLI that helps you see the route of a query. 

It is based on the traditional traceroute command, but it presents each of the hops on the way, with a table-like view and data like data loss, amount of packets sent, the time of the return of each hop. 

How to use Linux MTR command? 

It is a command for Linux distros, but it doesn’t come pre-installed. 

  1. Open the Terminal application. 
  2. Now use this command for installing it. 

For Ubuntu, Debian, or distros that are closely based on them, write:

sudo apt-get install mtr

Write your password and press Enter. 

For CentOS, Feroda, or RedHat:

sudo yum install mtr

Again, password and Enter. 

  1. Now you can try to ping a particular domain that you want with: mtr Change the with the one you want. 

The full syntax is:

 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]

Use additional options and extend the functionality of the MTR command.

*You can easily install the MTR command on macOS with Brew (brew install mtr) or on FreeBSD (sudo pkg iWnstall package_name).

MTR available options on Linux

OptionWhat is does?
-h–helpSee all the available options.
-v–versionVersion of the MTR command.
-r–reportThis starts the report mode. Will run, depending on the count value (–c).  
-w–report-wideWide report mode (+hostnames). 
-c COUNT–report-cycles COUNTNumber of pings. 
-s BYTES–psize BYTES PACKETSIZEPackets’ size in bytes. 
-t–cursesCurses-based terminal interface.
-n–no-dnsShow IP numbers instead of hostname.
-g–gtkGTK+ interface. 
-p–splitSplit-user interface. 
-l–rawSet to raw output format. 
-a IP.ADD.RE.SS–address IP.ADD.RE.SSSet outgoing packets’ sockets to a specified interface. 
-i SECONDS–interval SECONDSInterval, between the ICMP ECHO requests. 
-uUDP for queries.
-4IPv4 only.
-6IPv6 only.

Examples of how to use the MTR command

Use these examples of the MTR command, and apply them with your domain names and IP addresses by simply changing that part from them.

See the route of a query


You can see the individual hops with their hostnames and statistics about the time it took and packets’ lost. You can use an IP address instead of a domain name. When you get enough data, press “Ctrl+C” to stop it. 

Set a number of pings 

If you want to set a particular amount of queries, you can use the “-c” option and put the number. When it finishes, it will auto-exit. 

mtr -c 99

Print the result with the Report Mode

You can use the so-called Report Mode and put the result directly into a TXT file. It makes it practical if you want to see the result later. 

mtr -r -c 99 >TXT file name

Set time interval between the pings

You can set time in seconds, from one ICMP ECHO to another. 

mtr -i 99

Use UDP or TCP instead of the ICMP ECHO

If you want to use one of these protocols, you can with these MTR commands: 

mtr –udp

mtr –tcp

Set the packets’ size

You can decide what packets’ size to use for your queries. The size will be in bytes. 

mtr -r -s 64

Set maximum time between hops

The default time is already set to 30 seconds, but you can increase it and allow a bit more waiting time for each hop. The time we set here is 60 seconds, and we use the IP address

mtr -m 60

Leave a Reply

Your email address will not be published. Required fields are marked *