Sorry, your browser cannot access this site
This page requires browser support (enable) JavaScript
Learn more >

打开文件的进程

定位到打开的进程

lsof <file>
$ lsof /opt/mysql/data/5690/mysql-error.log 
COMMAND   PID                USER   FD   TYPE DEVICE SIZE/OFF     NODE NAME
mysqld  12858 actiontech-universe    1w   REG  253,1     6345 20083533 /opt/mysql/data/5690/mysql-error.log
mysqld  12858 actiontech-universe    2w   REG  253,1     6345 20083533 /opt/mysql/data/5690/mysql-error.log

端口占用

lsof 查看端口占用语法格式:

lsof -i
lsof -i:端口号

查看服务器 8000 端口的占用情况:

$ lsof -i:8000
COMMAND   PID USER   FD   TYPE   DEVICE SIZE/OFF NODE NAME
nodejs  26993 root   10u  IPv4 37999514      0t0  TCP *:8000 (LISTEN)

可以看到 8000 端口已经被轻 nodejs 服务占用。

评论