Skip to content

Instantly share code, notes, and snippets.

@mosuka
Created February 26, 2016 05:31
Show Gist options
  • Save mosuka/a769b1da3cf89d4dbfa8 to your computer and use it in GitHub Desktop.
Save mosuka/a769b1da3cf89d4dbfa8 to your computer and use it in GitHub Desktop.
Extract IP address from ifconfig command.
ifconfig -a | grep -e "inet[^6]" |\
sed -e "s/.*inet[^6][^0-9]*\([0-9.]*\)[^0-9]*.*/\1/" |\
grep -v "^127\."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment