Home·Terminal commands

traceroute

Networking

Usage

traceroute -n <host>

Lists the routers a packet passes on the way to a destination; a `* * *` line in the middle does not mean the path is broken, only that that router declines to answer.

Common flags

FlagMeaning
-nSkip reverse DNS, which makes it much faster.
-m 20Stop after twenty hops instead of the default thirty.
-q 1One probe per hop instead of three.
-w 1Wait one second per probe.
-IUse ICMP echo instead of UDP; needs root.
-T -p 443Use TCP to a real port, which firewalls usually let through (Linux).

Examples

traceroute -n 8.8.8.8

The path packets take, without name lookups.

sudo traceroute -T -p 443 example.com

Trace over TCP 443 when UDP probes are blocked (Linux).

When a connection fails, these narrow down how far it got — name not resolving, no route, or a blocked port.

How to read this

  • Square brackets [ ] mark a part you may leave out.
  • An ellipsis … means you can list more than one.
  • Flags are case-sensitive — in some commands -r and -R do different things.

Questions

Q. What does traceroute do?

Lists the routers a packet passes on the way to a destination; a `* * *` line in the middle does not mean the path is broken, only that that router declines to answer.

Q. How do I type it?

traceroute -n <host> — square brackets mark the parts you can leave out.

Q. How many flags are worth knowing?

6 are listed here; the full set is in man traceroute. This command sits under Networking.

Related commands

man page: man traceroute