[linux]查看linux下端口占用
2023-02-18 16:47:47 时间
netstat
netstat -an | grep 23 (查看是否打开23端口)
查看端口占用情况的命令:lsof -i
[root@www ~]# lsof -i
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
nginx 2333 root 6u IPv4 6242 TCP *:http (LISTEN)
nginx 2334 www 6u IPv4 6242 TCP *:http (LISTEN)
sshd 2349 root 3u IPv6 6283 TCP *:ndmp (LISTEN)
sshd 2349 root 4u IPv6 6286 TCP *:ssh (LISTEN)
查看某一端口的占用情况:lsof -i:端口号
[root@www ~]# lsof -i:21
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
pure-ftpd 2651 root 4u IPv4 7047 TCP *:ftp (LISTEN)
pure-ftpd 2651 root 5u IPv6 7048 TCP *:ftp (LISTEN)
结束占用端口的进程:kill -9 pid
[root@www ~]# kill -9 2651
相关文章
- C++矩阵库Armadillo在Visual Studio中的配置
- PHP使用curl上传文件到远程服务器接口
- VBA: 自动定时关闭消息框
- VBA:基于指定列删除重复行
- VBA: 单元格区域基于指定列重新排序(3)
- VBA: 提高 VBA 宏性能的 8 个技巧
- VBA: 批量重命名文件夹和文件名称
- Power BI: 日期表的创建
- Go语言中常见100问题-#1 Unintended variable shadowing
- Go语言中常见100问题-#2 Unnecessary nested code
- Go语言中常见100问题-#3 Misusing init functions
- Go语言中常见100问题-#4 Overusing getters and setters
- Go语言中常见100问题-#5 Interface pollution
- Go语言中常见100问题-#6 Interface on the producer side
- Go语言中常见100问题-#7 Returning interfaces
- Go语言中常见100问题-#8 any says nothing
- Go语言中常见100问题-#9 Being confused about when to use generics
- Go语言中常见100问题-#10 Not being aware of the possible problems ...
- Go语言中常见100问题-#11 Not using the functional options pattern
- Go语言中常见100问题-#12 Project misorganization