查看本机上的端口使用情况netstat -an「建议收藏」

查看本机上的端口使用情况netstat -an「建议收藏」1.查找本机上的端口使用情况netstat-an2.查找指定端口的使用情况C:\Windows\System32>netstat-ano|find"8002"

大家好,又见面了,我是你们的朋友全栈君。

1.查找本机上的端口使用情况

netstat -an

查看本机上的端口使用情况netstat -an「建议收藏」

 

 

2.查找指定端口的使用情况

C:\Windows\System32>netstat -ano | find “8002”
TCP 0.0.0.0:8002 0.0.0.0:0 LISTENING 2884
TCP [::]:8002 [::]:0 LISTENING 2884

参数说明:

-a 列出所有的

-n 数字的形式列出

-o 显示进程编号

输出结果:

第一列是协议类型,第二列是local address,第三列是remote address,第四列是状态,最后一列是进程编号

 

2.1找到占用端口的应用程序

查找结果的最后一列是进程编号,可以在任务管理器里找到对应的进程

C:\Windows\System32\inetsrv>netstat -ano | find “8080”
TCP 0.0.0.0:8080 0.0.0.0:0 LISTENING 2564
TCP 172.31.212.108:54133 172.16.210.31:8080 ESTABLISHED 6804
TCP 172.31.212.108:60264 172.16.210.31:8080 TIME_WAIT 0
TCP 172.31.212.108:60266 172.16.210.31:8080 TIME_WAIT 0
TCP 172.31.212.108:60267 172.16.210.31:8080 TIME_WAIT 0
TCP 172.31.212.108:60268 172.16.210.31:8080 TIME_WAIT 0
TCP 172.31.212.108:60304 172.16.210.31:8080 TIME_WAIT 0
TCP 172.31.212.108:60307 172.16.210.31:8080 TIME_WAIT 0
TCP 172.31.212.108:60320 172.16.210.31:8080 TIME_WAIT 0
TCP 172.31.212.108:60324 172.16.210.31:8080 TIME_WAIT 0
TCP 172.31.212.108:60333 172.16.210.31:8080 TIME_WAIT 0
TCP 172.31.212.108:60337 172.16.210.31:8080 TIME_WAIT 0
TCP 172.31.212.108:60341 172.16.210.31:8080 TIME_WAIT 0
TCP 172.31.212.108:60342 172.16.210.31:8080 ESTABLISHED 11820
TCP 172.31.212.108:60344 172.16.210.31:8080 ESTABLISHED 11820
TCP 172.31.212.108:60345 172.16.210.31:8080 TIME_WAIT 0
TCP 172.31.212.108:60346 172.16.210.31:8080 TIME_WAIT 0
TCP 172.31.212.108:60347 172.16.210.31:8080 TIME_WAIT 0
TCP 172.31.212.108:60349 172.16.210.31:8080 TIME_WAIT 0
TCP 172.31.212.108:60354 172.16.210.31:8080 CLOSE_WAIT 17116
TCP 172.31.212.108:60355 172.16.210.31:8080 CLOSE_WAIT 17116
TCP 172.31.212.108:60356 172.16.210.31:8080 ESTABLISHED 7540
TCP 172.31.212.108:60358 172.16.210.31:8080 ESTABLISHED 7540
TCP 172.31.212.108:60365 172.16.210.31:8080 ESTABLISHED 6804
TCP 172.31.212.108:60369 172.16.210.31:8080 FIN_WAIT_2 6804
TCP 172.31.212.108:60390 172.30.115.41:8080 TIME_WAIT 0
TCP 172.31.212.108:60392 172.30.115.41:8080 TIME_WAIT 0
TCP 172.31.212.108:60400 172.16.210.31:8080 FIN_WAIT_2 6804
TCP 172.31.212.108:60405 172.16.210.31:8080 FIN_WAIT_2 6804
TCP 172.31.212.108:60406 172.30.115.41:8080 ESTABLISHED 11876
TCP 172.31.212.108:60422 172.16.210.31:8080 FIN_WAIT_2 6804
TCP 172.31.212.108:60447 172.30.115.41:8080 TIME_WAIT 0
TCP 172.31.212.108:60459 172.30.115.41:8080 TIME_WAIT 0
TCP 172.31.212.108:60460 172.30.115.41:8080 ESTABLISHED 11876
TCP 172.31.212.108:60469 172.30.115.41:8080 ESTABLISHED 11876
TCP 172.31.212.108:60474 172.30.115.41:8080 ESTABLISHED 11876
TCP 172.31.212.108:60481 172.30.115.41:8080 TIME_WAIT 0
TCP 172.31.212.108:60484 172.30.115.41:8080 ESTABLISHED 11876
TCP 172.31.212.108:60485 172.30.115.41:8080 ESTABLISHED 11876
TCP 172.31.212.108:60486 172.30.115.41:8080 ESTABLISHED 11876
TCP 172.31.212.108:60487 172.30.115.41:8080 TIME_WAIT 0
TCP 172.31.212.108:60488 172.30.115.41:8080 ESTABLISHED 11876
TCP 172.31.212.108:60490 172.30.115.41:8080 TIME_WAIT 0
TCP 172.31.212.108:60492 172.30.115.41:8080 ESTABLISHED 11876
TCP 172.31.212.108:60495 172.30.115.41:8080 ESTABLISHED 11876
TCP 172.31.212.108:60497 172.30.115.41:8080 ESTABLISHED 11876
TCP 172.31.212.108:60499 172.30.115.41:8080 ESTABLISHED 11876
TCP 172.31.212.108:60501 172.30.115.41:8080 TIME_WAIT 0
TCP 172.31.212.108:60504 172.30.115.41:8080 TIME_WAIT 0
TCP 172.31.212.108:60514 172.16.210.31:8080 ESTABLISHED 6804
TCP 172.31.212.108:60515 172.16.210.31:8080 ESTABLISHED 6804
TCP 172.31.212.108:60516 172.16.210.31:8080 ESTABLISHED 6804
TCP 172.31.212.108:60517 172.16.210.31:8080 ESTABLISHED 6804
TCP 172.31.212.108:60518 172.16.210.31:8080 ESTABLISHED 6804
TCP 172.31.212.108:60519 172.16.210.31:8080 ESTABLISHED 6804
TCP [::]:8080 [::]:0 LISTENING 2564
TCP [::1]:8080 [::1]:60363 TIME_WAIT 0
TCP [::1]:8080 [::1]:60366 TIME_WAIT 0
TCP [::1]:8080 [::1]:60367 TIME_WAIT 0
TCP [::1]:8080 [::1]:60424 ESTABLISHED 2564
TCP [::1]:8080 [::1]:60425 ESTABLISHED 2564
TCP [::1]:8080 [::1]:60426 ESTABLISHED 2564
TCP [::1]:8080 [::1]:60427 ESTABLISHED 2564
TCP [::1]:8080 [::1]:60428 ESTABLISHED 2564
TCP [::1]:8080 [::1]:60429 ESTABLISHED 2564
TCP [::1]:8080 [::1]:60508 ESTABLISHED 2564
TCP [::1]:8080 [::1]:60509 ESTABLISHED 2564
TCP [::1]:8080 [::1]:60510 ESTABLISHED 2564
TCP [::1]:8080 [::1]:60511 ESTABLISHED 2564
TCP [::1]:8080 [::1]:60512 ESTABLISHED 2564
TCP [::1]:8080 [::1]:60513 ESTABLISHED 2564
TCP [::1]:60364 [::1]:8080 TIME_WAIT 0
TCP [::1]:60424 [::1]:8080 ESTABLISHED 11876
TCP [::1]:60425 [::1]:8080 ESTABLISHED 11876
TCP [::1]:60426 [::1]:8080 ESTABLISHED 11876
TCP [::1]:60427 [::1]:8080 ESTABLISHED 11876
TCP [::1]:60428 [::1]:8080 ESTABLISHED 11876
TCP [::1]:60429 [::1]:8080 ESTABLISHED 11876
TCP [::1]:60508 [::1]:8080 ESTABLISHED 6804
TCP [::1]:60509 [::1]:8080 ESTABLISHED 6804
TCP [::1]:60510 [::1]:8080 ESTABLISHED 6804
TCP [::1]:60511 [::1]:8080 ESTABLISHED 6804
TCP [::1]:60512 [::1]:8080 ESTABLISHED 6804
TCP [::1]:60513 [::1]:8080 ESTABLISHED 6804

 

https://serverfault.com/questions/342481/understanding-the-netstat-command-output

from netstat -h:

-a            Displays all connections and listening ports.

As in both current connections and listening ports (half open).

-n            Displays addresses and port numbers in numerical form.

As in, do not resolve addresses to host names.

Your computer can and regularly does connect to itself, usually for IPC or administrative tasks.

*.* = All IPv4 addresses (it’s listening, so accept connections from any IPv4)
[::] = All IPv6 addresses (same reason as the last).

 

3.使用图形界面查看

查看本机上的端口使用情况netstat -an「建议收藏」

 

查看本机上的端口使用情况netstat -an「建议收藏」

 

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/155392.html原文链接:https://javaforall.cn

【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛

【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...

(0)
blank

相关推荐

  • HP磁盘阵列损坏的修复

    HP磁盘阵列损坏的修复公司中有一台HPDL380G5服务器硬盘红灯报警,使用ACU工具查看后,显示磁盘损坏,截图如下:更换磁盘后,显示正在重建,即属于正常,截图如下:更换硬盘前需要确认硬盘是什么型号,哪个系列的,以及硬盘的大小:最重要的是SPARE号一定要保持一致。下面给大家提供一下更换磁盘的一些资料以及注意事项:1、更换的磁盘与原先的磁盘无比保持大小相同,型号…

  • java获取当前时间秒单位的时间

    java获取当前时间秒单位的时间获取当前时间秒单位的时间功能很常见但是具体怎么操作呢下面来说明几种常见获取单位秒的时间方式publicstaticvoidmain(String[]args){ //最常见获取方式 System.out.println(System.currentTimeMillis()/1000); //jdk1.8LocalDateTime获取世界统一时间 System.out.println(LocalDateTime.now().toEpochSecond(ZoneOffset.UTC

  • 《数据库系统概论》第五版 +学习笔记总目录

    《数据库系统概论》第五版 +学习笔记总目录文章目录前言第1章绪论第2章关系数据库第3章关系数据库标准语言SQL第4章数据库安全性第5章数据库完整性第6章关系数据理论前言本篇文章学习书籍:《数据库系统概论》第5版王珊萨师煊编著学习软件:NavicatPremium15&&SSMS采用数据库:SQLSever说明:虽然数据库是SQLSever有些书上的语句执行不了,貌似书采用的是Oracle数据库的SQL,不过没关系,初学我们最重要的是掌握其思想,很多思想和方法语句在

  • ffmpeg采集摄像头数据_手机显示无法获取摄像头数据

    ffmpeg采集摄像头数据_手机显示无法获取摄像头数据这两天研究了FFmpeg获取DirectShow设备数据的方法,在此简单记录一下以作备忘。1.      列设备 ffmpeg-list_devicestrue-fdshow-idummy命令执行后输出的结果如下(注:中文的设备会出现乱码的情况):我自己的机器上列出了以下设备:[dshow@0388f5e0]DirectShowvideodevices[dshow@0388

    2022年10月12日
  • win7下,令人头疼的 classpnp.sys (附带:安装系统时蓝屏;0x0000007b)。[通俗易懂]

    win7下,令人头疼的 classpnp.sys (附带:安装系统时蓝屏;0x0000007b)。[通俗易懂]前言:1.今天到单位,打开笔记本,发现启动后,程序报appcrash错误。于是重启,使用安全模式进入,发现启动中停在classpnp.sys上,然后程序就再也不往下走了。安全模式都进入不了系统,我还是第一次遇到!!万恶的win7。——————————————-

  • linux nginx启动停止命令_nginx无法启动

    linux nginx启动停止命令_nginx无法启动目录一、启动/usr/local/nginx/sbin/nginx-c/usr/local/nginx/conf/nginx.conf二、停止1、从容停止(1)查看进程号:ps-ef|grepnginx(2)杀死进程:kill-quitxxxx2、快速停止(1)查看进程号:ps-ef|grepnginx(2)杀死进程:kill-termxxxx/kill-intxxxx3、强制停止:pkill-9nginx三、重启1…

发表回复

您的电子邮箱地址不会被公开。

关注全栈程序员社区公众号