Home > Operation and Maintenance > Linux Operation and Maintenance > How to check port status in linux

How to check port status in linux

王林
Release: 2019-11-06 11:25:52
Original
17853 people have browsed it

How to check port status in linux

#Linux uses the netstat command to view port status.

The parameters of the netstat command are described as follows:

-a: List all network status, including Socket programs;

-c seconds Number: Specify how many seconds to refresh the network status;

-n: Use IP address and port number to display, do not use domain name and service name;

-p: Display PID and program name ;

-t: Display the connection status of the TCP protocol port;

-u: Display the connection status of the UDP protocol port;

-I: Display only the listening status Connection;

-r: Display routing table;

The netstat command can be combined with grep to view a specific port and service status.

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

Check which services and ports are on a server

netstat -lanp
Copy after login

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

ps -ef |grep mysqld
Copy after login

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

netstat -pnt |grep :3306 |wc
Copy after login

checks the connection client IP of a certain port. For example, port 3306

netstat -anp |grep 3306
Copy after login

View network port

netstat -an
Copy after login

Recommended tutorial: linux tutorial

The above is the detailed content of How to check port status in 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