-
-
Save pepoviola/7add9bac80c3c5dd53396f36dadc52be 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