tracepath command in Linux with Examples
Last Updated :
05 Sep, 2024
The 'tracepath' command in Linux is a network diagnostic tool used to trace the path packets take to reach a destination, discovering the Maximum Transmission Unit (MTU) along the way. It operates similarly to the traceroute command but does not require superuser privileges and offers a simpler set of options, making it user-friendly and accessible for basic network troubleshooting. Additionally, 'tracepath6' serves as an alternative to traceroute6 for IPv6 addresses, leveraging Linux error queues effectively.
What Does the 'tracepath' Command Do?
The primary purpose of the 'tracepath' command is to trace the network path to a specified destination and identify the MTU of each hop along the path. This information is valuable for diagnosing network issues, such as packet fragmentation or routing problems. Unlike traceroute, 'tracepath' uses a range of UDP ports instead of requiring elevated privileges, making it a safer and more accessible option for regular users.
Syntax:
tracepath [-n] [-b] [-l pktlen] [-m max_hops] [-p port] destination
'tracepath' command Example in Linux
tracepath command without any option: It will print the general syntax of the command along with the various options that can be used with the tracepath command as well as gives a brief description about each option.

- In the following example using tracepath command we are trying to trace path to destination for google.com.
tracepath www.google.com
Options Available for the tracepath Command
1. tracepath -n
This option prints primarily IP addresses numerically.
Example:
tracepath -n www.google.com

2. tracepath -b
This option print both of host names and IP addresses.
Example:
tracepath -b www.google.com

3. tracepath -l
This option sets the initial packet length to 'pktlen' instead of '65535' for 'tracepath' or '128000' for 'tracepath6'.
Example:
tracepath -l 29 www.google.com

4. tracepath -m
This option will set maximum hops (or maximum TTLs) to 'max_hops' instead of 30.
Example:
tracepath -m 31 www.google.com

5. tracepath -p
This option will set the initial destination port to use.
Example:
tracepath -p 8080 www.google.com

Conclusion
The 'tracepath' command is a simple yet effective tool for network diagnostics in Linux. By tracing the route that packets take to a destination and discovering MTU sizes along the path, it provides valuable insights into network performance and potential issues. Its ease of use, combined with the lack of need for superuser privileges, makes it an ideal choice for both novice and experienced users looking to troubleshoot network connectivity problems.
Similar Reads
How to Manage System Services in Linux | systemctl Command Linux operating systems are known for their robustness and versatility, and managing system services is a crucial aspect of maintaining a well-functioning system. With the advent of systemd, a system and service manager for Linux operating systems, the systemctl command has become an essential tool
8 min read
tac command in Linux with Examples tac command in Linux is used to concatenate and print files in reverse. This command will write each FILE to standard output, the last line first. When no file is specified then this command will read the standard input. Here, we will look deeper into the tac command, exploring its syntax, various o
3 min read
Tail command in Linux with examples It is the complementary of head command. The tail command, as the name implies, prints the last N number of data of the given input. By default, it prints the last 10 lines of the specified files. If more than one file name is provided then data from each file is preceded by its file name. Syntax of
7 min read
How to Compress Files in Linux | Tar Command File compression is a fundamental task in managing and transferring data efficiently on a Linux system. The Tar command, short for Tape Archive, is a powerful tool that allows users to create compressed and archived files. In this comprehensive guide, we will explore the various options and examples
11 min read
tee command in Linux with examples tee command reads the standard input and writes it to both the standard output and one or more files. The command is named after the T-splitter used in plumbing. It basically breaks the output of a program so that it can be both displayed and saved in a file. It does both the tasks simultaneously, c
2 min read
time command in Linux with examples 'time' command in Linux is used to execute a command and prints a summary of real-time, user CPU time and system CPU time spent by executing a command when it terminates. 'real' time is the time elapsed wall clock time taken by a command to get executed, while 'user' and 'sys' time are the number of
6 min read
How to Monitor System Activity in Linux | top Command top command is used to show the Linux processes. It provides a dynamic real-time view of the running system. Usually, this command shows the summary information of the system and the list of processes or threads which are currently managed by the Linux Kernel. As soon as you will run this command it
10 min read
How to Create an Empty File in Linux | Touch Command The touch command is a standard command used in the UNIX/Linux operating system which is used to create, change and modify the timestamps of a file. Basically, there are two different commands to create a file in the Linux system which are as follows: touch command: It is used to create a file witho
7 min read
tr command in Unix/Linux with examples The tr command is a UNIX command-line utility for translating or deleting characters. It supports a range of transformations including uppercase to lowercase, squeezing repeating characters, deleting specific characters, and basic find and replace. It can be used with UNIX pipes to support more comp
4 min read
tracepath command in Linux with Examples The 'tracepath' command in Linux is a network diagnostic tool used to trace the path packets take to reach a destination, discovering the Maximum Transmission Unit (MTU) along the way. It operates similarly to the traceroute command but does not require superuser privileges and offers a simpler set
2 min read