G0dspeed's Blog

Stay Hungary, Stay Foolish
  1. 首页
  2. 经验技巧
  3. 正文

Get a list of Open Ports

2016/06/03 663点热度 0人点赞 0条评论

LINUX

netstat -lntu

as replied by @askmish will give you list of services running on your system on tcp and udp ports where

  • -l = only services which are listening on some port
  • -n = show port number, don't try to resolve the service name
  • -t = tcp ports
  • -u = udp ports
  • -p = name of the program

You don't need the 'p' parameter as you're only interested in getting which ports are free and not which program is running on it.

This only shows which ports on your system are used up, though. This doesn't tell you the status of your network e.g. if you're behind NAT and you want some services to be accessible from outside. Or if the firewall is blocking the port for outside visitors. In that case, nmap comes to the rescue. WARNING: Use nmap only on networks which are under your control. Also, there are firewall rules which can block nmap pings, you'll have to fiddle around with options to get correct results.

2016.09.27 更新
netstat -peanut 用这个参数更可以列出是哪个程序在占用哪个端口

Windows

netstat -ano 可以直接列出PID,然后到任务管理器里面可以根据PID查看是哪个程序。

标签: Linux port
最后更新:2016/11/15

G0dspeed

这个人很懒,什么都没留下

点赞
< 上一篇
下一篇 >

文章评论

取消回复

Time limit is exhausted. Please reload CAPTCHA.

COPYRIGHT © 2022 G0dspeed's Blog. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang