发布于 2017-05-05 04:43:53 | 104 次阅读 | 评论: 0 | 来源: 网友投递

这里有新鲜出炉的Linux常用命令,程序狗速度看过来!

Linux

Linux是一套免费使用和自由传播的类Unix操作系统,是一个基于POSIX和UNIX的多用户、多任务、支持多线程和多CPU的操作系统。它能运行主要的UNIX工具软件、应用程序和网络协议。


这篇文章主要介绍了Linux下查询外网IP的几种方法总结的相关资料,需要的朋友可以参考下

Linux下查询外网IP的几种方法总结

Curl 纯文本格式输出:


curl icanhazip.com
curl ifconfig.me
curl curlmyip.com
curl ip.appspot.com
curl ipinfo.io/ip
curl ipecho.net/plain
curl www.trackip.net/i

 curl JSON格式输出:


curl ipinfo.io/json
curl ifconfig.me/all.json
curl www.trackip.net/ip?json (有点丑陋)

 curl XML格式输出:


curl ifconfig.me/all.xml

curl 得到所有IP细节 (挖掘机)


curl ifconfig.me/all

使用 DYDNS (当你使用 DYDNS 服务时有用)


curl -s 'http://checkip.dyndns.org' | sed 's/.*Current IP Address: \([0-9\.]*\).*/\1/g'
curl -s http://checkip.dyndns.org/ | grep -o "[[:digit:].]\+"
 

使用 Wget 代替 Curl


wget http://ipecho.net/plain -O - -q ; echo
wget http://observebox.com/ip -O - -q ; echo

 使用 host 和 dig 命令

如果有的话,你也可以直接使用 host 和 dig 命令。


host -t a dartsclink.com | sed 's/.*has address //'
dig +short myip.opendns.com @resolver1.opendns.com

 bash 脚本示例:


#!/bin/bash
PUBLIC_IP=`wget http://ipecho.net/plain -O - -q ; echo`
echo $PUBLIC_IP

感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!



最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务