Learn About the Linux Command mtr

mtr combines the functionality of the traceroute and ping programs in a single network diagnostic tool.

How MTR Works

As mtr starts, it investigates the network connection between the host mtr runs on and HOSTNAME. by sending packets with purposely low TTLs. It continues to send packets with low TTL, noting the response time of the intervening routers. This allows mtr to print the response percentage and response times of the internet route to HOSTNAME. A sudden increase in packet loss or response time is often an indication of a bad (or simply overloaded) link.

Gentoo Penguin Antarctica
David Merron Photography / Getty Images

Installing and Using MTR

It's very simple to get started with MTR and dive into some basic usage. First, make sure that it's installed on your system. On Debian and Ubuntu based systems, it's not already there, but you can install it easily with:

$ sudo apt install mtr

Interestingly enough, both Debian and Ubuntu default to opening up an MTR window, rather than using it as a command line utility. You can still set up and launch MTR from the command line, but you'll get an interactive window to work in afterward.

Check Router Connection

Next, open up a terminal and try running MTR to check the connection to your router. If you don't know your router's IP address, it's usually, by default.

$ mtr
Linux MTR to router

Check out the results. MTR will keep sending packets as long as you allow it to run. It'll record vital information about the connection and let you know what kind of latency there is and whether packets are being lost.

Test Connection to External Site

If you're looking to test the connection to an external website, you can do that too by giving MTR the URL, rather than an IP address.

$ mtr lifewire.com
Linux MTR traceroute to site

Because MTR is a traceroute and the site is external, you'll also see connection information for every hop between your computer and the destination.

Specify Types and Ports

It's also nice to be able to specify the types of packets to send. You can send UDP packets with '-u' or TCP packets with '-T.' So, if you're diagnosing your connection to a UDP VPN connection, it'd look something like this:

$ mtr -u server.vpnservice.com

It's also useful to target a specific port. Say you can target your web server, and you get a response, but you still can't connect to the site it's hosting. Use MTR on ports 80 and 443 to make sure that there's nothing blocking access.

$ mtr -P 80
Linux MTR to port

There are plenty more options with MTR. Use the help flag(-h) or this reference to see what else it can do.

MTR Manual

As with any Linux command, there is a complete set of options and flags to help you fine tune your experience. You can pull it up with the '-h' flag or use this convenient reference.


mtr [-hvrctglsni] [--help] [--version] [--report] [--report-cycles COUNT] [--curses] [--split] [--raw] [--no-dns] [--gtk] [--address IP.ADD.RE.SS] [--interval SECONDS] [--psize BYTES | -p BYTESHOSTNAME [PACKETSIZE]




Print the summary of command line argument options.



Print the installed version of mtr.



This option puts mtr into report mode. When in this mode, mtr will run for the number of cycles specified by the -c option, and then print statistics and exit.

This mode is useful for generating statistics about network quality. Note that each running instance of mtr generates a significant amount of network traffic. Using mtr to measure the quality of your network may result in decreased network performance.


--report-cycles COUNT

Use this option to set the number of pings sent to determine both the machines on the network and the reliability of those machines. Each cycle lasts one second. This option is only useful with the -r option.


--psize BYTES


These options or a trailing PACKETSIZE on the command line sets the packet size used for probing. It is in bytes inclusive IP and ICMP headers



Use this option to force mtr to use the curses based terminal interface (if available).



Use this option to force mtr to display numeric IP numbers and not try to resolve the hostnames.



Use this option to force mtr to use the GTK+ based X11 window interface (if available). GTK+ must have been available on the system when mtr was built for this to work. See the GTK+ web page for more information about GTK+.



Use this option to set mtr to spit out a format that is suitable for a split-user interface.



Use this option to tell mtr to use the raw output format. This format is better suited for archival of the measurement results. It could be parsed to be presented into any of the other display methods.


--address IP.ADD.RE.SS

Use this option to bind outgoing packets' socket to a specific interface, so that any packet will be sent through this interface. NOTE that this option doesn't apply to DNS requests (which could be and could not be what you want).


--interval SECONDS

Use this option to specify the positive number of seconds between ICMP ECHO requests. The default value for this parameter is one second.

Use the man command (% man) to see how a command is used on your particular computer.

Was this page helpful?