在 Linux 下,telnet 本身并不能“查 IP”,它只是一个远程登录/测试端口的工具。不过根据你的真实需求,常见有这几种情况和对应做法:
如果你是想看某个域名对应的服务器 IP,可以:
telnet example.com 80
连接成功后,第一行通常会显示:
Trying 93.184.216.34...
Connected to example.com.
其中 93.184.216.34 就是 IP。
⚠️ 如果 telnet 没装:
yum install telnet # CentOS
apt install telnet # Ubuntu
ip addr
或
ifconfig
curl ifconfig.me
或
curl ipinfo.io/ip
比 telnet 更合适:
nslookup example.com
或
dig example.com
或
getent hosts example.com
telnet 192.168.1.10 22
ip addr / nslookup / dig如果你是具体想做某件事(比如:查别人 IP、查连接来源、查端口对应 IP),可以告诉我场景,我给你准确命令。