How to check port status with netstat

藏色散人
Release: 2023-01-03 09:29:52
Original
17127 people have browsed it

netstat查看端口状态的方法:首先打开终端命令窗口;然后通过命令“netstat -ntlp”查看当前所有tcp端口;最后通过“netstat -ntulp | grep 80”命令查看所有80端口使用情况即可。

How to check port status with netstat

本教程操作环境:linux5.9.8系统,DELL G3电脑。

netstat查看端口状态

netstat

netstat -tunlp用于显示 tcp,udp 的端口和进程等相关情况。

netstat 查看端口占用语法格式:

netstat -tunlp | grep 端口号
Copy after login
  • -t (tcp) 仅显示tcp相关选项
  • -u (udp)仅显示udp相关选项
  • -n 拒绝显示别名,能显示数字的全部转化为数字
  • -l 仅列出在Listen(监听)的服务状态
  • -p 显示建立相关链接的程序名

例如查看 8000 端口的情况,使用以下命令:

# netstat -tunlp | grep 8000tcp 0 0 0.0.0.0:8000 0.0.0.0:* LISTEN 26993/nodejs
Copy after login

更多命令:

netstat -ntlp //查看当前所有tcp端口 netstat -ntulp | grep 80 //查看所有80端口使用情况 netstat -ntulp | grep 3306 //查看所有3306端口使用情况
Copy after login

推荐学习:《linux视频教程

The above is the detailed content of How to check port status with netstat. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!