how to find out which ports are open?

run this command as root:

 

netstat -tulpn

 

t - tcp

u - udp

l - listenning

p - programs

n - dont resolve names

 

 

exmaple output:

 

Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address          Foreign Address     State         PID/Program name  
tcp        0       0           0.0.0.0:805                 0.0.0.0:*             LISTEN      4439/rpc.statd     
tcp        0       0           0.0.0.0:111                 0.0.0.0:*             LISTEN      4400/portmap       
tcp        0       0           :::8098                     :::*                        LISTEN      2960/java          
tcp        0       0           :::8009                     :::*                        LISTEN      2960/java          
tcp        0       0           :::1099                     :::*                        LISTEN      2960/java          
tcp        0       0           :::8080                     :::*                        LISTEN      2960/java          
tcp        0       0           :::8083                     :::*                        LISTEN      2960/java          
tcp        0       0           :::22                         :::*                        LISTEN      4698/sshd

 

...


udp        0      0            0.0.0.0:32768        0.0.0.0:*                                  4868/avahi-daemon: 
udp        0      0            0.0.0.0:799            0.0.0.0:*                                  4439/rpc.statd     
udp        0      0            0.0.0.0:802            0.0.0.0:*                                  4439/rpc.statd     
udp        0      0            0.0.0.0:5353          0.0.0.0:*                                  4868/avahi-daemon: 
...

 
udp        0      0            :::123                      :::*                                          4734/ntpd 

 

 ---------------------------

on Windows, try this command: (option o: the owningg process ID associated with the connection)

 

netstat -anto | findstr 4848

 

example output:

c:\>netstat -anto | findstr 4848
  TCP    0.0.0.0:4848           0.0.0.0:0              LISTENING       3652     InHost
  TCP    127.0.0.1:4848         127.0.0.1:58533        ESTABLISHED     3652     InHost
  TCP    127.0.0.1:4848         127.0.0.1:58536        ESTABLISHED     3652     InHost
  TCP    127.0.0.1:58533        127.0.0.1:4848         ESTABLISHED     3280     InHost
  TCP    127.0.0.1:58536        127.0.0.1:4848         ESTABLISHED     3280     InHost

 

 

------------- find a windows process

tasklist /v | findstr java

 

Image Name                     PID Session Name        Session#    Mem Usage Status          User Name                                              CPU Time Window Title

========================= ======== ================ =========== ============ =============== ================================================== ============ ========================================================================

idea64.exe                    3408 Console                    2    567,476 K Running         FSNI\John.Wang                                   0:06:07 fsnz-scheduling-tms-service [C:\work-java\fsnz-scheduling-tms-service] -

 

------------- kill a Windows process

c:\>taskkill /F /PID 3652
SUCCESS: The process with PID 3652 has been terminated.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值