Skip to content

Instantly share code, notes, and snippets.

@zenith6
Created March 25, 2017 17:21
Show Gist options
  • Select an option

  • Save zenith6/06f9e6262a9d4e04b869265e585234fb to your computer and use it in GitHub Desktop.

Select an option

Save zenith6/06f9e6262a9d4e04b869265e585234fb to your computer and use it in GitHub Desktop.
detect primary global ip address on CentOS 7
#!/bin/bash
ip -o -4 addr | awk '/scope global/ { print substr($4, 0, index($4, "/") - 1) }'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment