traceroute Command in Linux
Overview
The traceroute command in Linux is used to track the route taken by a packet through an IP network. It is used to identify network connectivity issues and locate where the packet is lost or delayed. It is a useful tool for network troubleshooting and debugging.
Transform Your Career
Choose from our industry-leading programs designed for career success
Modern Software and AI Engineering Program
Master full-stack development with AI integration
+1000 moreModern Data Science and ML with specialisation in AI
Advanced data science techniques with AI specialization
+1000 moreAdvanced AIML with Specialisation in Agentic AI
Deep dive into AIML with focus on Agentic systems
+1000 moreDevOps, Cloud & AI Platform Engineering
Build and manage AI-powered cloud infrastructure
+1000 moreAI Engineering Advanced Certification by IIT-Roorkee
Premier AI engineering certification from IIT-Roorkee
Linux traceroute Command Syntax
The syntax for the traceroute command is as follows:
Where:
- options: Specifies the different options available for the traceroute command.
- host: Specifies the host name or IP address for which the route is to be traced.
traceroute Command Options:
- -n: Displays IP addresses instead of hostnames.
- -w: Sets the timeout for receiving a response.
- -q: Sets the number of queries per hop.
- -m: Sets the maximum number of hops to be searched.
Transform Your Career
Choose from our industry-leading programs designed for career success
Modern Software and AI Engineering Program
Master full-stack development with AI integration
+1000 moreModern Data Science and ML with specialisation in AI
Advanced data science techniques with AI specialization
+1000 moreAdvanced AIML with Specialisation in Agentic AI
Deep dive into AIML with focus on Agentic systems
+1000 moreDevOps, Cloud & AI Platform Engineering
Build and manage AI-powered cloud infrastructure
+1000 moreAI Engineering Advanced Certification by IIT-Roorkee
Premier AI engineering certification from IIT-Roorkee
Example Usages
-
Traces the route to the host google.com:
Output:
Explanation: This command traces the route to the host google.com and displays the IP addresses of each hop in the route.
-
Traces the route to the host github.com and sets the maximum number of hops to be searched as 10:
Output:
Explanation: This command traces the route to the host github.com and sets the maximum number of hops to be searched as 10, and stops tracing after 10 hops.
Tips
-
Use the -n option to display IP addresses instead of hostnames. This can be useful for debugging purposes.
-
Use the -w option to set the timeout for receiving a response. This can help to reduce the time taken for tracing the route.
-
Use the -q option to set the number of queries per hop. This can help to reduce the number of packets sent during the tracing process.
-
Use the -m option to set the maximum number of hops to be searched. This can help to limit the amount of network traffic generated during the tracing process.
Advanced Use Cases of traceroute Command in Linux
-
Traces the route to the host example.com and displays the time taken for each hop in milliseconds.:
Output:
Explanation: This command traces the route to the host example.com and displays the time taken for each hop in milliseconds. The -n option is used to display IP addresses instead of hostnames, and the time taken for each hop is displayed in milliseconds.
-
Traces the route to the host yahoo.com and sets the timeout for receiving a response as 1 second.:
Output:
Explanation: This command traces the route to the host yahoo.com and sets the timeout for receiving a response as 1 second. This can help to reduce the time taken for tracing the route.
-
Traces the route to the host facebook.com and sets the number of queries per hop as 2.:
Output:
Explanation: This command traces the route to the host facebook.com and sets the number of queries per hop as 2. This can help to reduce the number of packets sent during the tracing process.
Conclusion
-
The traceroute command in Linux is a useful tool for network troubleshooting and debugging.
-
It can be used to track the route taken by a packet through an IP network and identify network connectivity issues.
-
The -n, -w, -q, and -m options can be used to customize the traceroute command and improve its functionality.