Created
May 14, 2018 06:05
-
-
Save thomaslaurenson/2147a208c40a0031cb8355726b909207 to your computer and use it in GitHub Desktop.
This file contains 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
# Fetch the NIC name (e.g., eth0, ens33) | |
NIC=$(ifconfig -a | sed 's/[ \t].*//;/^\(lo\|\)$/d') | |
# Print the IP address of the NIC | |
ifconfig $NIC | awk '/t addr:/{gsub(/.*:/,"",$2);print$2}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment