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

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
Timothy_Hall
MVP Platinum
MVP Platinum

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

Max Power 2026 Book Now Available!
https://www.maxpowerfirewalls.com
Kaspars_Zibarts
Employee Alumnus
Employee Alumnus

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

0 Kudos
Martin_Valenta
Advisor

More reliable than show route destination IP in clish?

0 Kudos
Timothy_Hall
MVP Platinum
MVP Platinum

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

Max Power 2026 Book Now Available!
https://www.maxpowerfirewalls.com
0 Kudos

Leaderboard

Epsum factorial non deposit quid pro quo hic escorol.

Upcoming Events

    CheckMates Events