查看linux中的TCP连接

1. 查看哪些IP连接本机

netstat -npt

 

2. 查看TCP连接数

统计80端口连接数
netstat -npt | grep -i 11300 | wc -l
netstat -npt | grep -i 11300

统计httpd协议连接数
ps -ef | grep httpd | wc -l

统计已连接上的,状态为“established
netstat -npt | grep ESTABLISHED | wc -l

3. 查看TCP的创建时间

netstat -npt | grep <PORT> 
lsof -p <PID> | grep <PORT>
ll /proc/<PID>/fd/<fd>
posted @ 2023-02-09 14:30  渴望sunshine  阅读(899)  评论(0)    收藏  举报