0
0
Linux CLIscripting~15 mins

traceroute for path tracing in Linux CLI - Mini Project: Build & Apply

Choose your learning style9 modes available
Traceroute for Path Tracing
📖 Scenario: You want to find the path your data takes to reach a website. This helps you understand how your internet connection travels through different servers.
🎯 Goal: Build a simple script that uses traceroute to trace the path to a website and shows the result.
📋 What You'll Learn
Use the traceroute command to trace the path to example.com
Store the target website in a variable called target
Use a variable called max_hops to limit the number of hops to 5
Run traceroute with the -m option using max_hops
Print the traceroute output
💡 Why This Matters
🌍 Real World
Network administrators and users use traceroute to diagnose network paths and delays.
💼 Career
Understanding traceroute helps in troubleshooting network issues and improving connectivity.
Progress0 / 4 steps
1
Set the target website
Create a variable called target and set it to the string example.com.
Linux CLI
Need a hint?

Use target="example.com" to store the website.

2
Set the maximum hops
Create a variable called max_hops and set it to the number 5.
Linux CLI
Need a hint?

Use max_hops=5 to limit the hops.

3
Run traceroute with max hops
Write a command that runs traceroute with the -m option set to max_hops and the target set to target. Use command substitution to store the output in a variable called result.
Linux CLI
Need a hint?

Use result=$(traceroute -m $max_hops $target) to run traceroute and save output.

4
Print the traceroute result
Print the contents of the variable result to show the traceroute output.
Linux CLI
Need a hint?

Use printf "%s\n" "$result" to print the output.