利用curl命令查看Mac和Linux的ip地址

curl是http命令行工具。它支持文件的上传和下载。

curl命令可以拉取一个网页,语法也很简单:

1 curl http://www.linux.com

然后会返回:

1 <html>
2 <head><title>301 Moved Permanently</title></head>
3 <body>
4 <center><h1>301 Moved Permanently</h1></center>
5 <hr><center>nginx</center>
6 </body>
7 </html>

如果输入:

1 curl myip.ipip.net

则会返回:

1 当前 IP:xx.xxx.x.xxx  来自于:中国 北京 北京  电信

 测试网页返回值:

1 curl -o /dev/null -s -w %{http_code} www.linux.com

 

posted @ 2022-09-22 08:56  Lovaer  阅读(499)  评论(0编辑  收藏  举报