---
title: "A Guide to Running Traceroute in Linux"
description: "Learn how to use Traceroute on Linux with this quick and handy demo guide covering the basics and some popular switches."
canonical: "https://adamtheautomator.com/traceroute-linux/"
---

# A Guide to Running Traceroute in Linux

> Learn how to use Traceroute on Linux with this quick and handy demo guide covering the basics and some popular switches.

Source: https://adamtheautomator.com/traceroute-linux/

---

ATA Learning

Tap to hide

[

ATA Learning

](/)

*   [Home](/)
*   [Tutorials](/tutorials/)
*   [Instructors](/author/)
*   [Advertising](/advertising/)
*   [Recommended Resources](/resources/)
*   [About Adam](/about-adam/)

Search for:  

*   [](https://twitter.com/adbertram)
*   [](https://github.com/Adam-the-Automator)
*   [](https://www.linkedin.com/company/adam-the-automator-llc)
*   [](/feed/)

![A Guide to Running Traceroute in Linux](https://adamtheautomator.com/wp-content/uploads/2021/02/pexels-pixabay-373543.jpg)

# A Guide to Running Traceroute in Linux

[![](https://secure.gravatar.com/avatar/d0b9d42e21e5622713f8b693aa5c0f9244d5f7dd200ed29b8398f52dee5de337?s=192&d=mm&r=g)Adam Bertram](https://adamtheautomator.com/author/adam-bertram/)10 February 20213 min. read

Categories: [IT Ops](/category/it-ops/)

Tags:[Linux](/tag/linux/)

Table of Contents

*   [Inspecting Traceroute Parameters](#h-inspecting-traceroute-parameters)
*   [Basic Traceroute Functionality](#h-basic-traceroute-functionality)
*   [Adding Switches for More Precise Tracking](#h-adding-switches-for-more-precise-tracking)
*   [Excluding Hops with the First-Hop Switch](#h-excluding-hops-with-the-first-hop-switch)
*   [Limiting Hops with the Max-Hop Switch](#h-limiting-hops-with-the-max-hop-switch)
*   [Reducing Probe Packets Sent with the -Q Switch](#h-reducing-probe-packets-sent-with-the-q-switch)
*   [Summary](#h-summary)

If you need to figure out where your packets are going once they leave your Linux computer, traceroute on Linux is your friend.

Traceroute is a handy utility that’s on nearly every Linux distribution that tracks which routers your network packets traverse over a network. This utility is handy for troubleshooting or for simple network planning.

> _Not every distribution of Linux contains the same package for the `traceroute` command. Some distributions use the legacy [inetutils](https://www.gnu.org/software/inetutils/) package which contains traceroute as part of a suite of network tools, while others have a modern [traceroute.x86\_64 package](http://traceroute.sourceforge.net/)._

**_Related: [How to use Traceroute in Windows 10 (Tracert)](https://adamtheautomator.com/traceoute-windows-10/)_**

## Inspecting Traceroute Parameters

To get started, let’s first check out what’s possible with the Linux traceroute command.

Open up a terminal and type the command `traceroute -?` to get access [the manual page](https://linux.die.net/man/8/traceroute):

```powershell
Usage: traceroute [OPTION...] HOST
Print the route packets trace to network host.

  -f, --first-hop=NUM        set initial hop distance, i.e., time-to-live
  -g, --gateways=GATES       list of gateways for loose source routing
  -I, --icmp                 use ICMP ECHO as probe
  -m, --max-hop=NUM          set maximal hop count (default: 64)
  -M, --type=METHOD          use METHOD (`icmp' or `udp') for traceroute
                             operations, defaulting to `udp'
  -p, --port=PORT            use destination PORT port (default: 33434)
  -q, --tries=NUM            send NUM probe packets per hop (default: 3)
      --resolve-hostnames    resolve hostnames
  -t, --tos=NUM              set type of service (TOS) to NUM
  -w, --wait=NUM             wait NUM seconds for response (default: 3)
  -?, --help                 give this help list
      --usage                give a short usage message
  -V, --version              print program version

Mandatory or optional arguments to long options are also mandatory or optional
for any corresponding short options.

Report bugs to <bug-inetutils@gnu.org>.
```

As you can see above, you have a lot of options to tweak how traceroute works.

## Basic Traceroute Functionality

Although you have parameters to tweak traceroute, you don’t actually need all of them. You can, in fact, just run traceroute and provide the host to trace to. Once you do that, as you can see below, traceroute on Linux sends a 60-byte packet and follows every [hop](https://www.lifewire.com/what-are-hops-hop-counts-2625905) that it takes to get to the destination host.

It’s able to track these hops by using a time-to-live (TTL) on each packet decrementing it by one each time to detected when the package is no longer received.

![Traceroute to google.com](https://adamtheautomator.com/wp-content/uploads/2021/02/image-1024x785.png)

Traceroute to google.com

> _Know that traceroute has a maximum number of hops. It will only go up to 30 hops max._

## Adding Switches for More Precise Tracking

The default functionality of traceroute on Linux works well but there’s so much more you can do. Let’s now cover many of the most popular and useful switches that you have available.

### Excluding Hops with the First-Hop Switch

One helpful command excludes certain routers from the trace. Using the `-f` or `--first-hop=NUM` parameter, you can exclude certain routers from displaying. This could be very useful if you are confident that one or more routers are not causing any issues.

You can also use the `-f` switch to set the trace to begin past your network perimeter to narrow down any possible causes for latency on the Internet.

In the following GIF, you can see the command `traceroute -f 3 google.com` running. This command is skipping the first three routers thus bypassing my home networking and ISP router. Notice that the first two hops are missing.

![traceroute -f example](https://adamtheautomator.com/content/images/2020/05/6pGEYH9jNS.gif)

traceroute -f example

It takes 15 hops to reach [www.google.com](http://www.google.com) from my network from the above example. You see:

*   hop count
*   hostname or IP of the router along the path being traced
*   response times as before

You may see additional interfaces for some hopes in the output. This is expected.

### Limiting Hops with the Max-Hop Switch

Now lets say that in addition to skipping the first two hops, you also want the path up to the fifth hop in the route. That’s where you would use the `-m` or `--max-hop=NUM` switch parameter.

Type `traceroute -m 5 -f 3 http://www.google.com` into your terminal and press Enter. This command certainly is useful for narrowing potential routing issues. Traceroute now skips the first two hops and stops at the fifth hop.

![Traceroute skipping hops](https://adamtheautomator.com/wp-content/uploads/2020/07/RbN9BXR1LF-1024x179.gif)

Traceroute skipping hops

### Reducing Probe Packets Sent with the -Q Switch

Traceroute on Linux, by default, sends three probe packets to each router in the path. Perhaps you’d like to reduce the time `traceroute` takes to run. You can change the number of probe packets sent to each router using the `-q` parameter.

Type `traceroute -q -m 5 -f 3 www.google.com` into your terminal and press **Enter**. You can see below that `traceroute` is only sending one packet because we’re only getting one response time per hop.

![traceroute -q 6 example](https://adamtheautomator.com/content/images/2020/05/2QnYebaIy3.gif)

traceroute -q 6 example

You can also _increase_ the number of probe packets sent per hop too but specifying an argument for the `-q` parameter as shown below. Increasing packet probes sent could help by providing a way to average response times to each hop.

![Argument for -q Parameter](https://adamtheautomator.com/content/images/2020/05/4vXKGBoMv6.gif)

Argument for -q Parameter

## Summary

In this article on Traceroute for Linux, you learned the basics of using this handy utility. There is so much more you can do with this command. If you’d like to learn how to use every switch, be sure to check out the [man page](https://linux.die.net/man/8/traceroute).

Share this article

[Share on X](https://twitter.com/intent/tweet?url=https%3A%2F%2Fadamtheautomator.com%2Ftraceroute-linux%2F&text=A%20Guide%20to%20Running%20Traceroute%20in%20Linux)[Share on Facebook](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fadamtheautomator.com%2Ftraceroute-linux%2F)[Share on LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fadamtheautomator.com%2Ftraceroute-linux%2F)

## Related Posts

![](https://adamtheautomator.com/wp-content/uploads/2022/09/Practical-Linux-Unix-Tee-Commands-for-the-Linux-Admin.jpg)

### [Master Unix tee Commands for Real-World Linux Admin Tasks](/unix-tee/)

Simplify Linux output management and streamline your workflow with the “Unix tee” command. This tutorial guides you through its practical applications.

![](https://adamtheautomator.com/wp-content/uploads/2024/03/openldap-4.jpg)

### [How to Install and Configure an OpenLDAP Ubuntu Server](/openldap/)

Unlock the power of OpenLDAP on Ubuntu for centralized user authentication, seamless access control management, and enhanced directory services!

![](https://adamtheautomator.com/wp-content/uploads/2024/03/pipe-command-in-linux-1.jpg)

### [Unleashing the Power of the Pipe Command in Linux](/pipe-command-in-linux/)

Unlock the prowess of the pipe command in Linux to streamline tasks, boost productivity, and simplify complex operations effortlessly!

## Categories

*   [IT Ops](/category/it-ops/)
*   [Cloud](/category/cloud/)
*   [DevOps](/category/devops/)
*   [Home Ops](/category/home-ops/)
*   [Information Security](/category/infosec/)
*   [Software Development](/category/software-development/)

## Site

*   [Home](/)
*   [Tutorials](/tutorials/)
*   [Instructors](/author/)
*   [Advertising](/advertising/)
*   [Recommended Resources](/resources/)
*   [About Adam](/about-adam/)

Copyright 2026© ATA Learning | [Privacy Policy](/privacy/)
