Home > Operation and Maintenance > Linux Operation and Maintenance > How to check the port of linux

How to check the port of linux

(*-*)浩
Release: 2019-11-08 09:30:21
Original
13024 people have browsed it

How to check the port of linux

The parameters of the netstat command are described as follows:                                                                                                                                                      

## All ports and process services on the current server can be displayed. Combined with grep, you can view a specific port and service status.

  -t : 指明显示TCP端口
  -u : 指明显示UDP端口
  -l : 仅显示监听套接字(所谓套接字就是使应用程序能够读写与收发通讯协议(protocol)与资料的程序)
  -p : 显示进程标识符和程序名称,每一个套接字/端口都属于一个程序。
  -n : 不进行DNS轮询,显示IP(可以加速操作)
Copy after login

View which services and ports are on a server

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

Check how many ports a service has. For example, if you want to check mysqld

netstat  -lanp
Copy after login

to check the number of connections on a certain port, for example, 3306 port

ps -ef |grep mysqld
Copy after login

# check the connection client IP of a certain port For example, 3306 port######
netstat -pnt |grep :3306 |wc
Copy after login
######nmap port scan######
netstat -anp |grep 3306
netstat -an 查看网络端口 
lsof -i :port,使用lsof -i :port就能看见所指定端口运行的程序,同时还有当前连接。
Copy after login

The above is the detailed content of How to check the port of linux. 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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template