shell一键查询公网IP地址
shell一键查询公网IP地址。命令如下
curl -s http://myip.ipip.net
也可以直接写成shell脚本
1
2
3
4
#!/bin/bash
ip=$(curl -s http://myip.ipip.net)
echo "My public IP address is: $ip"
下面是常有的IP公网地址查询地址。
curl http://icanhazip.com
curl http://ifconfig.me
curl http://curlmyip.com
curl http://ipinfo.io/ip