查看本地监听端口和远程端口

本文介绍如何使用lsof命令查看本地计算机上正在监听的端口,并演示了telnet命令检查远程服务器端口是否开放的过程。示例中包括了不同应用程序监听的不同端口和服务。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

查看本地监听端口

E5450:~/opengrok_env$ lsof -i
COMMAND    PID      USER   FD   TYPE  DEVICE SIZE/OFF NODE NAME
gvfsd-smb 2020 zhixinlyl   11u  IPv4   26164      0t0  TCP 30.96.91.172:46732->30.96.88.255:netbios-ssn (ESTABLISHED)
adb       2172 zhixinlyl    6u  IPv4   31071      0t0  TCP localhost:5037 (LISTEN)
firefox   2406 zhixinlyl   52u  IPv4   91892      0t0  TCP 30.96.91.172:44132->140.205.32.75:https (ESTABLISHED)
firefox   2406 zhixinlyl   54u  IPv4   78492      0t0  UDP *:48462
firefox   2406 zhixinlyl   55u  IPv6   78494      0t0  UDP *:43172
firefox   2406 zhixinlyl   61u  IPv4 1097190      0t0  TCP 30.96.91.172:46474->119.147.70.227:https (ESTABLISHED)
firefox   2406 zhixinlyl   82u  IPv4 1029131      0t0  TCP 30.96.91.172:45680->42.156.235.98:https (ESTABLISHED)
firefox   2406 zhixinlyl   92u  IPv4   94886      0t0  TCP 30.96.91.172:54268->101.227.160.102:https (ESTABLISHED)
java      4976 zhixinlyl   48u  IPv6  101851      0t0  TCP *:http-alt (LISTEN)
java      4976 zhixinlyl   53u  IPv6  101855      0t0  TCP *:8009 (LISTEN)
java      4976 zhixinlyl   69u  IPv6  100684      0t0  TCP localhost:2424 (LISTEN)
java      4976 zhixinlyl   75u  IPv6  102723      0t0  TCP localhost:8005 (LISTEN)

 

查看远程监听端口

E5450:~/opengrok_env$ telnet www.baidu.com 80
Trying 14.215.177.38...
Connected to www.a.shifen.com.
Escape character is '^]'.

E5450:~/opengrok_env$ telnet www.baidu.com 8080
Trying 14.215.177.37...

 

 

转载于:https://my.oschina.net/u/269082/blog/897251

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值