AI Workshop: learn to build apps with AI →
Advanced Commands: traceroute - Trace Network Path

Join the AI Workshop and learn to build real-world apps with AI. A hands-on, practical program to level up your skills.


When you try to reach a host on the Internet, you go through your home router, then you reach your ISP network, which in turn goes through its own upstream network router, and so on, until you finally reach the host.

Have you ever wanted to know what are the steps that your packets go through to do that?

The traceroute command is made for this.

You invoke

traceroute <host>

and it will (slowly) gather all the information while the packet travels.

In this example I tried reaching for my blog with traceroute flaviocopes.com:

Not every router along the path returns information. In this case, traceroute prints * * *. Otherwise, we can see the hostname, the IP address, and some performance indicator.

For every router we can see 3 samples, which means traceroute tries by default 3 times to get you a good indication of the time needed to reach it. This is why it takes this long to execute traceroute compared to simply doing a ping to that host.

You can customize this number with the -q option:

traceroute -q 1 flaviocopes.com

The traceroute command works on Linux, macOS, WSL, and anywhere you have a UNIX environment

Lessons in this unit:

0: Introduction
1: su - Switch User
2: sudo - Superuser Do
3: passwd - Change Password
4: ping - Test Network
5: ▶︎ traceroute - Trace Network Path
6: history - Command History
7: export - Set Environment Variables
8: crontab - Schedule Tasks
9: alias - Create Shortcuts
10: man - Manual Pages
11: tar - Archive Files
12: gzip - Compress Files
13: gunzip - Decompress Files
14: basename - Strip Directory
15: dirname - Extract Directory
16: nano - Text Editor
17: vim - Vi Improved Editor
18: emacs - Text Editor
19: ed - Line Editor
20: How to use Netcat
21: How to download a file from a server using the terminal