A walkthrough for building a cross-platform `myip` shell script that retrieves both local and public IP addresses from the command line. For the public IP, it uses `curl` against ifconfig.me with flags for reliability. For the local IP on Linux, it uses `ip route get 1.1.1.1` with a Perl regex to extract the source address

10m read timeFrom nickjanetakis.com
Post cover image
Table of contents
# Public IP Address# Local IP Address# Dedicated Script# Demo Video

Sort: