Skip to main content

Command referencetraceroute

traceroute command (Linux / bash / sh / zsh)

Linuxbashshzshnetworkbeginner

What it does

Trace the network hops taken toward a destination. When people search for the traceroute command linux hops, they usually want traceroute's everyday flags, safe examples, and how it differs from related tools. Below you'll find syntax, options, and copyable examples for Bash/sh/zsh.

Trace the network hops taken toward a destination.

Syntax

traceroute [OPTION]... HOST [PACKET_LENGTH]

Common options

Flag / optionMeaning
-nDo not resolve hop addresses to names.
-m HOPSSet the maximum hop count.
-IUse ICMP echo probes.
-TUse TCP SYN probes.
-p PORTSet the destination port.

Practical examples

Trace route

traceroute example.com

Displays responding hops toward the host.

Numeric trace

traceroute -n 8.8.8.8

Avoids DNS lookup delays.

TCP trace

sudo traceroute -T -p 443 example.com

Traces with TCP probes to HTTPS.

Linux ↔ Windows equivalent

Closest match: tracert (Windows / CMD). Trace routers traversed on the way to an IP destination.

Common mistakes

  • Assuming every `*` means packet loss at the final destination.
  • Reading asymmetric hop timings as a precise map of the return path.

FAQ

What does traceroute do in Linux?

Trace the network hops taken toward a destination.

How do I use traceroute from the terminal?

Start with `traceroute [OPTION]... HOST [PACKET_LENGTH]`, then choose only the options needed for the task.

What is a practical traceroute example?

Try `traceroute example.com` — Displays responding hops toward the host.

Can I use traceroute in a shell script?

Yes. traceroute works in Bash, sh, and Zsh, but scripts should handle quoting, errors, and command output explicitly.

Browse the full Linux and Windows command reference to search more bash, CMD, PowerShell, Conda, and GitHub CLI commands.