命令行获取ip地址到文本_从命令行获取IP地址

命令行获取ip地址到文本

Over the past few years I've needed to look up my IP address a dozen times.  What's funny is that I don't recall why I needed it, I just did.  So what's the easiest way to get my IP address from the command line?

在过去的几年中,我需要多次查找我的IP地址。 有趣的是,我不记得为什么需要它,只是做了。 那么从命令行获取我的IP地址的最简单方法是什么?

To get your internal IP, you can do the following:

要获取内部IP,可以执行以下操作:


ipconfig getifaddr en0


I go through ipecho.net to get it:

我通过ipecho.net获得它:


curl ipecho.net/plain ; echo

#  >> 71.87.32.78


Why go through an external resource?  Your local address and your external address aren't the same, so using the external resource is the best way to tell what the world is seeing your IP address as.

为什么要通过外部资源? 您的本地地址和外部地址不相同,因此使用外部资源是最好的方式来告诉世界您的IP地址是什么。

翻译自: https://davidwalsh.name/get-ip-address

命令行获取ip地址到文本

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值