Now tracert and pathping, which are similar commands, will be covered. While this is a basic tutorial, there are some intermediate tips and topics included. The focus will be on Windows based systems (with a tip or two for other systems).
Both of these commands are designed to give you more detailed information than the ping command. They will tell you about steps along the way. This can help you narrow down where a problem is.
The tracert command is also called traceroute on other systems, such as on a Mac or in Cisco's IOS (used in its routers and switches). It is used to find out what other devices are on the path to a destination.
It works by sending out a number of signals. Each signal has a number of locations it can jump to, called a time to live (TTL). When it reaches that number, the device it reaches sends back an error message. For example, the first packet of data sent out would just have one hop, so it would stop at your home router. Your router sends back a signal, and the tracert command records it. The next signal would have to go two hops and so on, until the destination is reached.
Using the command is simple. You type in tracert and an IP number or website's name after it. You can see extra options by typing tracert /? in the command line.
To get the the command line, go to Start, Run, type cmd in, and press the Enter key.
After that, type tracert google.com in and hit Enter again. You should get something like this:
In Linux, the equivalent command is tracepath, but traceroute is available. Both commands perform similar actions, but you have to install traceroute on some systems (e.g. Ubuntu).
Type in "sudo apt-get install traceroute" from the terminal to grab it. Enter the name of the command and a IP number or a website's name to trace the path.
The pathping command is more similar to tracert than a simple ping. Just like the tracert command, pathping will give you information about all the steps along the path to the website you want to test.
It does this by sending out full ping commands along the way, gathering more information. This is done over a period of time, yielding a detailed report. The extra information is good to have, but the time required is a disadvantage. It can take a few minutes. Typically, tracert is the preferred command.
The command works the same way that tracert or ping do, where you type in the name of the command and the name of the site you want to test. There are some option, which you can see by typing "pathping /?" into the command line. For something similar in Linux, use the mtr command.
Assuming you did not close the command line window from before, type "pathping google.com" in and hit Enter. You should get a report similar to tracert, but it will tell you to wait for the extra results. There is a lot of information, so you may have to scroll a little to see it all.
Waiting roughly 6 minutes for a report is a bit much for one command. You can shorten the time to create the report with a command line option. Instead of sending 100 pings, "pathping google.com -q 10" will send 10 per hop, or "pathping google.com -q 3" will send 3 per hop.
Tracert command is notorious for lines that spill past the width of the screen; the pathping command never fits in a screen. By saving the output to a file, it will remove line breaks automatically. There is no manual editing involved, and the output is nicer.
To do this for tracert, type in "tracert google.com > file.txt" into the command line. If you are not familiar with DOS, or you are not sure where you put the file, you can use "notepad file.txt" (or even just "file.txt") in the command line to easily retrieve the file.
There is one problem with this method: it looks nothing is happening. This is even more evident with the pathping command, which can take several minutes to run (hence why controlling the pathping is covered above). Be patient; this is normal.
Side note: This is called "redirecting," and it is commonly done at the command line. Use one greater-than sign (>) to overwrite a file; use two greater-than signs (>>) to append data to a file.
This can also be done in Linux, but it is not necessary. If the tracepath command spills over the edge, you can re-size the terminal and run the command again. The DOS prompt has a fixed character width, so resizing the window will not help.
What You Can Infer
Tracert and pathping are useful in seeing where a problem is. If a command recognizes your router, but not much further, something is probably wrong with your ISP. If a command trails off, but cannot find the destination, the website probably is having a problem. Typically, it is better to start testing with the ping command because it faster than its counterparts.
There is going to be one last article in this series that puts all three commands together. Each one is a piece that you need to understand in order to use it. Combining them can make finding a problem easier.Advertisement
Ghacks is a technology news blog that was founded in 2005 by Martin Brinkmann. It has since then become one of the most popular tech news sites on the Internet with five authors and regular contributions from freelance writers.