虚拟化容器,大数据,DBA,中间件,监控。

Linux查看端口被哪个进程占用

17 09月
作者:admin|分类:系统运维

lsof -I 查看端口与进程信息

[root@dblink ~]# lsof -i:80
COMMAND    PID    USER   FD   TYPE  DEVICE SIZE/OFF NODE NAME

varnishd 32654 varnish    7u  IPv4 2004488      0t0  TCP dblink:http (LISTEN)


查看对应进程使用的文件

[root@dblink ~]# lsof -p 32654
COMMAND    PID    USER   FD      TYPE  DEVICE   SIZE/OFF      NODE NAME
varnishd 32654 varnish  cwd       DIR   253,0         40   2031139 /var/lib/varnish/dblink
varnishd 32654 varnish  rtd       DIR   253,0       4096       128 /
varnishd 32654 varnish  txt       REG   253,0     655648 201715242 /usr/sbin/varnishd
varnishd 32654 varnish  mem       REG   253,0      39946   2031142 /var/lib/varnish/dblink/vcl.upG5yx6K.so
varnishd 32654 varnish  mem       REG   253,0 1073741824   2031140 /var/lib/varnish/varnish_storage.bin
varnishd 32654 varnish  mem       REG   253,0   84934656   2031141 /var/lib/varnish/dblink/_.vsm
varnishd 32654 varnish  mem       REG   253,0      37152 206750435 /usr/lib64/libnss_sss.so.2
varnishd 32654 varnish  mem       REG   253,0      58288 201339269 /usr/lib64/libnss_files-2.17.so
varnishd 32654 varnish  mem       REG   253,0      44088 201339281 /usr/lib64/librt-2.17.so
varnishd 32654 varnish  mem       REG   253,0    2107760 201339251 /usr/lib64/libc-2.17.so
varnishd 32654 varnish  mem       REG   253,0     141616 201339277 /usr/lib64/libpthread-2.17.so
varnishd 32654 varnish  mem       REG   253,0    1141552 201339259 /usr/lib64/libm-2.17.so
varnishd 32654 varnish  mem       REG   253,0     113320 201339261 /usr/lib64/libnsl-2.17.so
varnishd 32654 varnish  mem       REG   253,0      19512 201339257 /usr/lib64/libdl-2.17.so
varnishd 32654 varnish  mem       REG   253,0     398272 201401559 /usr/lib64/libpcre.so.1.2.0
varnishd 32654 varnish  mem       REG   253,0     212096 201715240 /usr/lib64/libjemalloc.so.1
varnishd 32654 varnish  mem       REG   253,0      77768 135039707 /usr/lib64/varnish/libvgz.so
varnishd 32654 varnish  mem       REG   253,0     132864 135039706 /usr/lib64/varnish/libvcc.so
varnishd 32654 varnish  mem       REG   253,0       6696 135039705 /usr/lib64/varnish/libvarnishcompat.so
varnishd 32654 varnish  mem       REG   253,0      91656 135039704 /usr/lib64/varnish/libvarnish.so
varnishd 32654 varnish  mem       REG   253,0     164336 201339244 /usr/lib64/ld-2.17.so
varnishd 32654 varnish    0r      CHR     1,3        0t0      1028 /dev/null
varnishd 32654 varnish    1w     FIFO     0,8        0t0   2004491 pipe
varnishd 32654 varnish    2w     FIFO     0,8        0t0   2004491 pipe
varnishd 32654 varnish    3u      REG   253,0 1073741824   2031140 /var/lib/varnish/varnish_storage.bin
varnishd 32654 varnish    4r     FIFO     0,8        0t0   2004492 pipe
varnishd 32654 varnish    5w     FIFO     0,8        0t0   2004492 pipe
varnishd 32654 varnish    6r     FIFO     0,8        0t0   2004493 pipe
varnishd 32654 varnish    7u     IPv4 2004488        0t0       TCP dblink:http (LISTEN)
varnishd 32654 varnish    8r     FIFO     0,8        0t0   2004489 pipe
varnishd 32654 varnish    9w     FIFO     0,8        0t0   2004493 pipe
varnishd 32654 varnish   10u  a_inode     0,9          0      6134 [eventpoll]
varnishd 32654 varnish   11w     FIFO     0,8        0t0   2004490 pipe
varnishd 32654 varnish   15u     IPv4 2854538        0t0       TCP localhost:30973->localhost:radan-http (CLOSE_WAIT)



netstat -anp 查看端口与进程信息

[root@ruifengkeji2 ~]# netstat -anp

Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:56165           0.0.0.0:*               LISTEN      2945/ora_d000_hextr
tcp        0      0 0.0.0.0:111             0.0.0.0:*               LISTEN      992/rpcbind         
tcp        0      0 0.0.0.0:1521            0.0.0.0:*               LISTEN      2849/tnslsnr        
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1324/sshd           
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      2171/master         
tcp        0      0 127.0.0.1:1521          127.0.0.1:2514          ESTABLISHED 41028/oraclehextrac
tcp        0      0 202.99.199.14:1521      202.99.199.14:32214     ESTABLISHED 2849/tnslsnr        
tcp        0      0 202.99.199.14:22        211.162.125.127:31041   ESTABLISHED 46491/sshd: root@pt
tcp        0      0 202.99.199.14:22        183.93.185.68:8138      ESTABLISHED 41743/sshd: root@no
tcp        0      0 202.99.199.14:1521      211.162.125.127:8420    ESTABLISHED 17061/oraclehextrac
tcp        0      0 127.0.0.1:1521          127.0.0.1:2518          ESTABLISHED 41048/oraclehextrac
tcp        0      0 127.0.0.1:1521          127.0.0.1:2520          ESTABLISHED 41050/oraclehextrac
tcp        0      0 202.99.199.14:22        211.162.125.127:39253   ESTABLISHED 35892/sshd: root@no
tcp        0    248 202.99.199.14:22        183.93.185.68:8079      ESTABLISHED 41696/sshd: root@pt
tcp        0      0 202.99.199.14:22        211.162.125.127:45240   ESTABLISHED 39476/sshd: root@pt
tcp        0      0 127.0.0.1:1521          127.0.0.1:2516          ESTABLISHED 41037/oraclehextrac
tcp        0      0 202.99.199.14:32214     202.99.199.14:1521      ESTABLISHED 2919/ora_pmon_hextr
tcp        0      0 127.0.0.1:1521          127.0.0.1:2515          ESTABLISHED 41035/oraclehextrac
tcp        0      0 202.99.199.14:22        211.162.125.127:15825   ESTABLISHED 45000/sshd: root@no
tcp        0      0 127.0.0.1:1521          127.0.0.1:2521          ESTABLISHED 41057/oraclehextrac
tcp        0      0 127.0.0.1:1521          127.0.0.1:2517          ESTABLISHED 41044/oraclehextrac
tcp        0      0 127.0.0.1:1521          127.0.0.1:2622          ESTABLISHED 41684/oraclehextrac
tcp        0      0 127.0.0.1:1521          127.0.0.1:2623          ESTABLISHED 41686/oraclehextrac
tcp        0      0 202.99.199.14:22        183.93.185.67:5708      ESTABLISHED 40839/sshd: root@pt
tcp6       0      0 202.99.199.14:12000     :::*                    LISTEN      40979/java          
tcp6       0      0 127.0.0.1:8005          :::*                    LISTEN      1535/java           
tcp6       0      0 :::8009                 :::*                    LISTEN      1535/java




浏览1892 评论0
返回
目录
返回
首页
AUTO_SPACE_ADVISOR_JOB系统作业运行故障导致插入表被阻塞 Apache实现http跳转https