Skip to content

Instantly share code, notes, and snippets.

@oanhnn
Created July 19, 2023 02:45
Show Gist options
  • Save oanhnn/c168f91d498e64eba466d62b02474b65 to your computer and use it in GitHub Desktop.
Save oanhnn/c168f91d498e64eba466d62b02474b65 to your computer and use it in GitHub Desktop.
Show My IP on MacOS
#!/bin/bash
echo "Public IP:" $(curl -s ifconfig.me)
echo "Private IP:"
echo "- en0:" $(ipconfig getifaddr en0 || echo 'Not connected')
echo "- en5:" $(ipconfig getifaddr en5 || echo 'Not connected')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment