Linux查看端口被占用情况
Last updated
2023-03-28 16:00:01
{"value":"### \u89e3\u51b3\u65b9\u6848\n\n#### \u4e00\u3001\u67e5\u770b\u5df2\u77e5\u7aef\u53e3\u88ab\u5360\u7528\u7684\u60c5\u51b5\n\n\u4f8b\u5982\uff1a\u67e5\u770b\u7aef\u53e322\u7684\u4f7f\u7528\u60c5\u51b5\uff0c\u6216\u8005\u662f\u88ab\u54ea\u4e2a\u7a0b\u5e8f\u5360\u7528\u4e86\uff0c\u547d\u4ee4\u5982\u4e0b\n\n\tnetstat -anp | grep 22\n\n![](http:\/\/156.248.76.32:4999\/server\/index.php?s=\/api\/attachment\/visitFile&sign=68217a6c464dfd367375268f7f068018)\n\n\u4e5f\u53ef\u4ee5\u4f7f\u7528\u547d\u4ee4\n\n\tnetstat -tln | grep 22\n\n![](http:\/\/156.248.76.32:4999\/server\/index.php?s=\/api\/attachment\/visitFile&sign=a894e20098c82eec51a2db84464282fa)\n\n**\u4e24\u4e2a\u547d\u4ee4\u7684\u533a\u522b\u662f\uff1a\u524d\u8005\u591a\u663e\u793a\u7684\u662f\u8fdb\u7a0b\u53f7\u4ee5\u53ca\u88ab\u54ea\u4e2a\u7a0b\u5e8f\u6240\u5360\u7528\u3002**\n\n####\u4e8c\u3001\u67e5\u770b\u5168\u90e8\u7aef\u53e3\u5360\u7528\u60c5\u51b5\n\n\tnetstat -anp\n\n\u6216\u8005\n\n\tnetstat -tln\n\n####\u4e09\u3001\u67e5\u770b\u5177\u4f53\u7aef\u53e3\u88ab\u54ea\u4e2a\u7a0b\u5e8f\u5360\u7528\n\n\tlsof -i :22\n\n![](http:\/\/156.248.76.32:4999\/server\/index.php?s=\/api\/attachment\/visitFile&sign=1b62013a0ea5a558909144cbf4eb2d6d)\n\n\u53ef\u4ee5\u770b\u523022\u7aef\u53e3\u6b63\u5728\u88abTCP\u7a0b\u5e8f\u5360\u7528\uff0c\u8fdb\u7a0b\u53f7\u4e3a 1237 \uff08\u8fdb\u7a0b\u53f7\u4e0d\u4e00\u5b9a\u76f8\u540c\uff09\n\n####\u56db\u3001kill\u88ab\u5360\u7528\u7684\u8fdb\u7a0b\n\n\u6211\u4eec\u901a\u8fc7\u6b65\u9aa4\u4e09\u4e2d\u7684\u547d\u4ee4\u5f97\u5230PID\u5bf9\u5e94\u76841237\uff0c\u6216\u8005\u901a\u8fc7\u547d\u4ee4\u201cnetstat -anp | grep 22\u201d\u5f97\u5230\u7684\u201c1237\/sshd\u201d\uff0c\u8fd9\u91cc\u76841237\u90fd\u662f\u7aef\u53e3\u5360\u7528\u7684\u5bf9\u5e94\u8fdb\u7a0b\u7684\u8fdb\u7a0b\u53f7\uff0c\u6211\u4eec\u6740\u6389\u5bf9\u5e94\u8fdb\u7a0b\u53f7\u5373\u53ef;\u547d\u4ee4\u5982\u4e0b\uff1a\n\n\tkill -9 1237\n\n####\u4e94\u3001\u68c0\u67e5\u5bf9\u5e94\u7aef\u53e3\u662f\u5426\u8fd8\u5728\u5360\u7528\n\n\u5728\u6b65\u9aa4\u56db\u4e2d\uff0c\u6211\u4eeckill\u4e86\u5bf9\u5e94\u7684\u8fdb\u7a0b\uff0c\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7\u6b65\u9aa4\u4e00\u4e2d\u7684\u547d\u4ee4\u518d\u67e5\u770b\u4e00\u4e0b22\u7aef\u53e3\u7684\u4f7f\u7528\u60c5\u51b5\u3002\n\n\tnetstat -anp | grep 22\n\n![](http:\/\/156.248.76.32:4999\/server\/index.php?s=\/api\/attachment\/visitFile&sign=27cc7b41d0d7eabb40ef4a0ebca68f08)\n\n\u8f93\u5165\u547d\u4ee4\u540e\u53d1\u73b0\u6ca1\u6709\u4efb\u4f55\u7ed3\u679c\uff0c\u8bf4\u660e\u5df2\u7ecfkill\u6389\u4e86\u5bf9\u5e94\u7684\u8fdb\u7a0b"}