How do I print only an IP address list of a traceroute run?

I don't want the web addresses like something-online.net and their round trip times.

How do I get a "simple" traceroute from the terminal?

  • You need to add an example of what output you're currently seeing and what you are looking for. This is too vague. – Stuart McLaughlin Sep 1 '11 at 8:21

Are you looking for traceroute -n? From the man page:

   -n     Do not try to map IP addresses to  host  names  when  displaying

Edit: Comment added further requirement of removing round trip times.

To display everything except round trip times (sequence and IP address), CSV-formatted:

traceroute -n | tail -n+2 | awk '{ print $1 "," $2 }'
  • yes, but how do I out it to a csv file without the round trip times in ms? – epsilon8 Sep 1 '11 at 8:25
  • Pipe the output into awk to print only the IP columns. – Gaff Sep 1 '11 at 8:31

Building on Dave Sherohman's answer. As I'm using using MinGW64, I only have access to tracert and not traceroute.

tracert uses the -d flag instead of the -n flag:

  -d                 Do not resolve addresses to hostnames.

And, here's some example output:

$ tracert -d | tail -n+2 | awk '{ print $8 }'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.