linux查看端口占用情况
linux-dash
A beautiful web dashboard for Linux
项目地址:https://gitcode.com/gh_mirrors/li/linux-dash
免费下载资源
·
参考: https://www.cnblogs.com/wangtao1993/p/6144183.html
1. 使用lsof
lsof -i:端口号 用于查看某一端口的占用情况,比如查看8000端口使用情况,lsof -i:8000
[root@mini1 ~]# lsof -i:6379
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
redis-ser 20936 redis 6u IPv4 44220 0t0 TCP *:6379 (LISTEN)
2. 使用netstat
netstat -tnlp可以查看tcp端口占用情况,具体参数含义如下:
-t (tcp) 仅显示tcp相关选项
-u (udp)仅显示udp相关选项
-n 拒绝显示别名,能显示数字的全部转化为数字
-l 仅列出在Listen(监听)的服务状态
-p 显示建立相关链接的程序名
查看tcp端口占用如下:
[root@mini1 ~]# netstat -tnlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 192.168.239.100:27017 0.0.0.0:* LISTEN 892/mongod
tcp 0 0 127.0.0.1:27017 0.0.0.0:* LISTEN 892/mongod
tcp 0 0 127.0.0.1:6379 0.0.0.0:* LISTEN 20904/redis-server
tcp 0 0 0.0.0.0:9042 0.0.0.0:* LISTEN 900/java
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 893/sshd
tcp 0 0 192.168.239.100:7000 0.0.0.0:* LISTEN 900/java
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1354/master
tcp 0 0 127.0.0.1:7199 0.0.0.0:* LISTEN 900/java
tcp 0 0 127.0.0.1:43235 0.0.0.0:* LISTEN 900/java
tcp6 0 0 :::5672 :::* LISTEN 1051/java
tcp6 0 0 :::3306 :::* LISTEN 1027/mysqld
tcp6 0 0 :::61613 :::* LISTEN 1051/java
tcp6 0 0 :::61614 :::* LISTEN 1051/java
tcp6 0 0 :::61616 :::* LISTEN 1051/java
tcp6 0 0 :::22 :::* LISTEN 893/sshd
tcp6 0 0 ::1:25 :::* LISTEN 1354/master
tcp6 0 0 :::1883 :::* LISTEN 1051/java
tcp6 0 0 :::39454 :::* LISTEN 1051/java
tcp6 0 0 :::8161 :::* LISTEN 1051/java
结合 grep 命令可以查看指定端口的占用情况
[root@mini1 ~]# netstat -tnlp | grep 6379
tcp 0 0 0.0.0.0:6379 0.0.0.0:* LISTEN 20963/redis-server
GitHub 加速计划 / li / linux-dash
10.39 K
1.2 K
下载
A beautiful web dashboard for Linux
最近提交(Master分支:2 个月前 )
186a802e
added ecosystem file for PM2 4 年前
5def40a3
Add host customization support for the NodeJS version 4 年前
更多推荐
已为社区贡献2条内容
所有评论(0)