Skip to content

Instantly share code, notes, and snippets.

@geminixiang
Last active February 14, 2025 02:49
Show Gist options
  • Save geminixiang/946f4e3882b6cf3364cdc227ad50bc00 to your computer and use it in GitHub Desktop.
Save geminixiang/946f4e3882b6cf3364cdc227ad50bc00 to your computer and use it in GitHub Desktop.
ip.sh
#!/bin/bash
echo "內網 IP: $(ipconfig getifaddr en0)"
echo "外網 IP: $(curl -s ifconfig.me)"
@geminixiang
Copy link
Author

curl -fsSL https://gist.githubusercontent.com/geminixiang/946f4e3882b6cf3364cdc227ad50bc00/raw/a809b3ec5110e48aad58203c58c03e761781c28a/ip.sh | sh

@geminixiang
Copy link
Author

geminixiang commented Feb 14, 2025

Fish shell

# 添加以下指令到 ~/.config/fish/config.fish,source ~/.config/fish/config.fish

alias myip="curl -fsSL https://gist.githubusercontent.com/geminixiang/946f4e3882b6cf3364cdc227ad50bc00/raw/a809b3ec5110e48aad58203c58c03e761781c28a/ip.sh | sh"
❯ myip
內網 IP: 192.168.0.101
外網 IP: 1.*.*.*

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment