zoukankan      html  css  js  c++  java
  • 释放Linux占用端口

    查看所有被占用的端口列表

    
    	shell> netstat -lntp
    
    
    
    	Active Internet connections (only servers)
    	Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
    	tcp        0      0 127.0.0.1:6379          0.0.0.0:*               LISTEN      3285/redis-server 1 
    	tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      1/systemd           
    	tcp        0      0 192.168.122.1:53        0.0.0.0:*               LISTEN      2310/dnsmasq        
    	tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1011/sshd           
    	tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN      1007/cupsd          
    	tcp6       0      0 :::111                  :::*                    LISTEN      1/systemd           
    	tcp6       0      0 :::22                   :::*                    LISTEN      1011/sshd           
    	tcp6       0      0 ::1:631                 :::*                    LISTEN      1007/cupsd          
    	tcp6       0      0 :::4000                 :::*                    LISTEN      10793/docker-proxy 
    
    

    根据端口号查找到对应进程PID

    
    	# 如查看端口号为 `4000` 的进程占用情况
        
    	shell> lsof -i :4000
    
    
    
    	COMMAND     PID USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
    	docker-pr 10793 root    4u  IPv6  95507      0t0  TCP *:terabase (LISTEN)
    
    

    释放端口占用

    
    	# 如释放 `PID` 为 `10793` 的进程
        
    	shell> kill -9 10793
    
    
  • 相关阅读:
    axios基础用法
    CSS盒子模型
    前端跨域问题解决方案
    跨域-iframe
    swagger UI配置
    React安装和启动
    React 学习笔记
    redis学习笔记
    10个排序算法,待更新
    docker常用命令,持续更新。。。
  • 原文地址:https://www.cnblogs.com/warnerwu/p/7020580.html
Copyright © 2011-2022 走看看