動機
紀錄
找listening port
ss -tulpn- t,u: tcp, udp
- l: listening
- p: 列process
- n: 別做DNS
lsof -i- i: 所有網路連線
-i tcp:1-100-i udp:80
- i: 所有網路連線
這port是做什麼的
去/etc/services看,或是google
找誰開了file
lsof <your file>- 誰開了
<your file>
- 誰開了
lsof -u bee314- bee314開了哪些file
lsof -c <proc>- proc開了哪些file
lsof -p <pid>- pid開了哪些file
lsof -c ^<proc>- not 條件
lsof -c <proc> -u bee314- or 條件
lsof -a -c <proc> -u bee314- and 條件
Ref
Linux Find Out Which Process Is Listening Upon a Port Linux 列出行程開啟的檔案,lsof 指令用法教學與範例