Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

How to find your public IP address from command-line?

+3
−0

ip a command will conveniently show the addresses assigned to your network interfaces, but oftentimes this is not what the internet sees your machine as.

So how to find your public IP address from command-line?

History
Why does this post require moderator attention?
You might want to add some details to your flag.
Why should this post be closed?

1 comment thread

If you want to find your public IP address using the command line, you can utilize tools like "curl" ... (1 comment)

3 answers

+2
−0

There are probably myriad services for echoing your IP back over HTTP. Here are a couple:

curl https://api.ipify.org
curl https://ip.me
curl https://icanhazip.com
History
Why does this post require moderator attention?
You might want to add some details to your flag.

0 comment threads

+1
−0

In case Ipify stops being free: https://dnsleaktest.com/ will show you your IP. I don't know if they have an API, but it's easy to parse the HTML:

https dnsleaktest.com | rg '\d+\.\d+\.\d+\.\d+' --only-matching

(the commands are https://httpie.io/ and https://github.com/BurntSushi/ripgrep)

History
Why does this post require moderator attention?
You might want to add some details to your flag.

0 comment threads

+1
−0

Cisco's OpenDNS (nothing to do with open source) has this magic domain myip.opendns.com which resolves to your own public IP address when looked up with standard DNS tools.

For example with dog (or dig):

$ dog +short myip.opendns.com @resolver1.opendns.com
History
Why does this post require moderator attention?
You might want to add some details to your flag.

0 comment threads

Sign up to answer this question »