Linux 查看IP

我怕爱的太早我们不能终老 提交于 2021-01-15 07:40:30

UBuntu 系统下 按Ctrl+Alt+T 唤出终端

在终端输入: ifconfig 命令

点击回车 就可以看到自己电脑在局域网的IP地址了

图中第二行 inet 地址:192.168.1.101 就是你的电脑在局域网的IP地址了

如果输入 ifconfig 提示 找不到命令

那就在终端输入:sudo apt-get install net-tools 安装网络工具

安装完成后输入: sudo apt-get update 更新软件包

完成之后 再次输入 ifconfig 命令 就不会出现错误了
 

用Linux命令行获取本机外网IP地址

  

 $ curl ifconfig.me

 

[root@localhost ~]# curl ifconfig.me

14.23.92.186


 $ curl icanhazip.com

 

[root@localhost ~]# curl icanhazip.com

14.23.92.186


 $ curl ident.me

 

[root@localhost ~]# curl ident.me

14.23.92.186


 $ curl ipecho.net/plain

 

[root@localhost ~]# curl ipecho.net/plain

14.23.92.186


 $ curl whatismyip.akamai.com

 

[root@localhost ~]# curl whatismyip.akamai.com

14.23.92.186


 $ curl tnx.nl/ip

 

[root@localhost ~]# curl tnx.nl/ip

14.23.92.186


 $ curl myip.dnsomatic.com

 

[root@localhost ~]# curl myip.dnsomatic.com

14.23.92.186


 $ curl ip.appspot.com

 

[root@localhost ~]# curl ip.appspot.com

curl: (7) couldn't connect to host


 $ curl -s checkip.dyndns.org | sed 's/.*IP Address: [0−9\.]∗[0−9\.]∗.*/\1/g'

[root@localhost ~]# curl -s checkip.dyndns.org | sed 's/.*IP Address: [0−9\.]∗[0−9\.]∗.*/\1/g'

14.23.92.186
 

 

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!