From cae9b8ca7156654f7f983f33acf7bb23758a6e6f Mon Sep 17 00:00:00 2001 From: Fechin Date: Fri, 2 Oct 2026 23:24:49 -0400 Subject: [PATCH] docs(content): add myip.dog public IP tips to cheatsheets --- source/_posts/alpine-linux.md | 10 ++++++++++ source/_posts/bash.md | 13 +++++++++++++ source/_posts/curl.md | 3 +++ source/_posts/netstat.md | 10 ++++++++++ source/_posts/ssh.md | 16 ++++++++++++++++ 5 files changed, 52 insertions(+) diff --git a/source/_posts/alpine-linux.md b/source/_posts/alpine-linux.md index 32a77b9..bd576f1 100644 --- a/source/_posts/alpine-linux.md +++ b/source/_posts/alpine-linux.md @@ -118,6 +118,16 @@ ip route show vi /etc/network/interfaces ``` +Check this machine's public IP + +```bash +# Install curl if needed +apk add --no-cache curl +curl myip.dog +``` + +More IP tools: [myip.dog](https://myip.dog/) + ### User Management ```bash diff --git a/source/_posts/bash.md b/source/_posts/bash.md index 6b5a12b..14200fc 100644 --- a/source/_posts/bash.md +++ b/source/_posts/bash.md @@ -861,6 +861,19 @@ if ping -c 1 google.com; then fi ``` +### Public IP + +```bash +# Show this machine's public IP +curl myip.dog + +# Save the IP for use in a script +public_ip=$(curl -fsS myip.dog) +printf '%s\n' "$public_ip" +``` + +More IP tools: [myip.dog](https://myip.dog/) + ### Special variables {.row-span-2} | Expression | Description | diff --git a/source/_posts/curl.md b/source/_posts/curl.md index 1cd69d1..c78e692 100644 --- a/source/_posts/curl.md +++ b/source/_posts/curl.md @@ -162,6 +162,7 @@ curl -sSL https://get.rvm.io | bash | command | description | | :------------------------------------------------------------------------------------------ | :----------------------------- | +| `curl myip.dog` | get this machine's public `IP` | | `curl -L -s http://ipecho.net/plain, curl -L -s http://whatismijnip.nl` | get my public `IP` | | `curl -u $username:$password http://repo.dennyzhang.com/README.txt` | `curl` with credentials | | `curl -v -F key1=value1 -F upload=@localfilename ` | `curl` upload | @@ -170,6 +171,8 @@ curl -sSL https://get.rvm.io | bash | `curl -u test:test ftp://10.32.99.187/cryptopp552.zip -o cryptopp552.zip` | curl `ftp` download | | `curl -v -u admin:admin123 --upload-file package1.zip http://mysever:8081/dir/package1.zip` | upload with credentials `curl` | +More IP tools: [myip.dog](https://myip.dog/) + ### Check website response time {.col-span-4} ```shell diff --git a/source/_posts/netstat.md b/source/_posts/netstat.md index c2039dd..dec76e0 100644 --- a/source/_posts/netstat.md +++ b/source/_posts/netstat.md @@ -62,6 +62,16 @@ $ netstat -h | `netstat -i` | Show network interfaces | | `netstat -ie` | Show network interfaces extended info | +### Public IP + +Check this machine's public IP + +```shell script +$ curl myip.dog +``` + +More IP tools: [myip.dog](https://myip.dog/) + ### Routing | Option | Example | diff --git a/source/_posts/ssh.md b/source/_posts/ssh.md index 9702b42..b669b9a 100644 --- a/source/_posts/ssh.md +++ b/source/_posts/ssh.md @@ -59,6 +59,22 @@ Compresses and downloads from a server $ ssh root@192.168.1.5 "tar cvzf - ~/source" > output.tgz ``` +### Public IP + +Check this machine's public IP + +```shell script +$ curl myip.dog +``` + +Check a remote server's public IP (requires curl on the server) + +```shell script +$ ssh user@server 'curl myip.dog' +``` + +More IP tools: [myip.dog](https://myip.dog/) + ### SCP {.row-span-2} Copies from remote to local