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.
- Log in to your server, or start the Terminal application
- Write the command:
sudo apt update
this will update the list of all packages available
- Install with the following command:
sudo apt -y install mtr
- Open the Terminal app
- Install first the Homebrew with the following command:
/bin/bash -c “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)”
- Now, you can install the MTR command with:
brew install mtr
- Log into your server, or start the Terminal application
- 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.
MTR command’s options
|-r-report||Report mode needs -c to specific the cycles before showing statistics at the end.|
|-w-report-wide||Extended report mode.|
|-c COUNT–report-cycles COUNT||The number of pings that must be sent.|
|-s BYTES–psize BYTES PACKETSIZE||Choose the size of packets. If you chose a negative value, they would have a random size.|
|-t–curses||Curses-based terminal interface|
|-n–no-dns||Show IP address, don’t resolve the hostname.|
|-l–raw||Raw output format.|
|-a IP.ADD.RE.SS–address IP.ADD.RE.SS||Link packets’ sockets to a specific interface|
|-i SECONDS–interval SECONDS||Seconds between pings.|
|-4||IPv4 address only.|
|-6||IPv6 address only.|
The MTR command is a nifty tool for network diagnostic. Try it out!