cancel
Showing results for 
Search instead for 
Did you mean: 
Create a Post

If you are tired typing netstat -nr | grep ^x.x.x.x

Might be very obvious for some but in case your routing table is long and you need to search for routes with grep, you might want to add a "shortcut" as follows

echo '#!/bin/bash'>/usr/bin/showroute; echo 'netstat -nr|grep ^$1'>/usr/bin/showroute; chmod +x /usr/bin/showroute

then use showroute as your command instead of netstat to find routes, i.e

of course you can change showroute alias to something else Smiley Happy

4 Replies

Re: If you are tired typing netstat -nr | grep ^x.x.x.x

Definitely handy, and one can also use ip route get (IP) to find the one matching route that would be used if (IP) was the destination.

--
Second Edition of my "Max Power" Firewall Book
Now Available at http://www.maxpowerfirewalls.com

"IPS Immersion Training" Self-paced Video Class
Now Available at http://www.maxpowerfirewalls.com

Re: If you are tired typing netstat -nr | grep ^x.x.x.x

i was just trying to minimise words to type and use tab..  happy weekend!

0 Kudos

Re: If you are tired typing netstat -nr | grep ^x.x.x.x

More reliable than show route destination IP in clish?

0 Kudos

Re: If you are tired typing netstat -nr | grep ^x.x.x.x

Pretty sure they will both give the same result, would be very surprised if they didn't.

--
Second Edition of my "Max Power" Firewall Book
Now Available at http://www.maxpowerfirewalls.com

"IPS Immersion Training" Self-paced Video Class
Now Available at http://www.maxpowerfirewalls.com
0 Kudos