Linux 查看IP

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
 

 

posted @   飞龙在生  阅读(4857)  评论(0编辑  收藏  举报
编辑推荐:
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
点击右上角即可分享
微信分享提示