3 ms·
For someone looking for a simple CLI option to get your remote IPv4, you can use the following: dig +short myip.opendns.com @resolver1.opendns.com In my c
by TheAceOfHearts 9y ago
For someone looking for a simple CLI option to get your remote IPv4, you can use the following:
dig +short myip.opendns.com @resolver1.opendns.com
In my case, I have a ip_remote.fish file in my $HOME/.config/fish/functions folder which defines an ip_remote function that executes the line above.
As an added bonus, you can get all local IPv4 with:
ifconfig | sed -En 's/127.0.0.1//;s/.*inet (addr:)?(([0-9]*\.){3}[0-9]*).*/\2/p'
- coderholic 9y agoCurl ipinfo.io seems simpler, and provides a lot more information! If you do just want the ip then curl ipinfo.io/ip