Sign up ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

The BSD route command has a feature that will show what route will be selected for a given host. For example:

/Users/mhaase $ route get
   route to:
  interface: en0
 recvpipe  sendpipe  ssthresh  rtt,msec    rttvar  hopcount      mtu     expire
       0         0         0         0         0         0      1500         0 

I occasionally find this useful if I am manually messing with routing tables to make sure that the routing rules are working as expected.

The GNU version of route does not have this same "get" subcommand. Is there some equivalent or alternative for GNU/Linux?

share|improve this question

1 Answer 1

up vote 12 down vote accepted

There is

ip route get

but it doesn't do hostname resolution (which I think is a good thing). The command is usually available from iproute or iproute2 packages.

share|improve this answer
ip route get "$(dig +short)" for hostname resolution. –  jordanm Oct 31 '12 at 17:28
@jordanm, More like: dig +short | xargs -tn1 ip route get –  Stéphane Chazelas Oct 31 '12 at 20:16

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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