Skip to content

Instantly share code, notes, and snippets.

@geekbass
Created March 19, 2018 14:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save geekbass/2a95e2896c3a45632629a528cf1eb322 to your computer and use it in GitHub Desktop.
Save geekbass/2a95e2896c3a45632629a528cf1eb322 to your computer and use it in GitHub Desktop.
Get the main network interface of a machine. Used to ip-detect in DC/OS.
#!/bin/bash
ip route get 8.8.8.8 | awk '{print $7; exit}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment