Created
November 30, 2020 21:41
-
-
Save LozanoMatheus/09c8537cba9586e0ba8a8f7e18c9ce17 to your computer and use it in GitHub Desktop.
Get Linux IP without any tool
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
## Get the primary and secundary IPs | |
awk '/\|--/ && !/\.0$|\.255$/ {print $2}' /proc/net/fib_trie | |
## Get only the primary IPs | |
awk '/32 host/ { print i } {i=$2}' /proc/net/fib_trie |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment