zoukankan      html  css  js  c++  java
  • Linux 如何查看端口与进程占用情况

    1 lsof -i:port  查看端口使用情况

    lsof -i 如果出现 command not found,直接yum install lsof即可。

    (1) lsof -i

    lsof -i 用以显示符合条件的进程情况,lsof(list open files)是一个列出当前系统打开文件的工具。以root用户来执行lsof -i命令,如下图

    (2) lsof -i:port

    lsof -i:端口号,用于查看某一端口的占用情况,比如查看22号端口使用情况,lsof -i:22,如下图

    2 netstat -tunlp|grep port

    netstat -tunlp用于显示tcp,udp的端口和进程等相关情况,如下图

    netstat -tunlp|grep 端口号,用于查看指定端口号的进程情况,如查看22端口的情况,netstat -tunlp|grep 22,如下图

    3 强制关闭某个进程

    (1) pkill -9 pid 

    通过进程ID 强制杀掉该进程

    (2) 通过停掉端口来强制杀掉进程

    netstat -tln

    fuser -k -n tcp 80

  • 相关阅读:
    JavaScript
    CSS
    HTML5&CSS
    I2C mux和复杂拓扑
    如何实例化I2C设备
    SMBus 协议
    I2C 协议
    I2C和SMBus简介
    ubuntu20.04系统下更新Raspberry Pi4的DTB
    通过configfs配置的Linux USB gadget
  • 原文地址:https://www.cnblogs.com/Latiny/p/11101295.html
Copyright © 2011-2022 走看看