Skip to content

Instantly share code, notes, and snippets.

@bitboss-ca
bitboss-ca / whatsmyip.sh
Created April 9, 2013 17:19
A handy way to get your public IP address from a command line. This has been tested on Mac and FreeBSD.
#!/bin/sh
curl -s https://www.google.ca/search\?q\=whats+my+ip | awk '{print substr($0,index($0,"Client IP address"),34)}' | cut -d ')' -f 1 | head -n1 | sed 's/Client/Public/'