Show binaries and libraries of a PID
Show only the executable and the loaded shared libraries; -a joins the filters with AND, useful after a deploy
lsof -p <pid> -a -d txt,mem
- tool
- lsof19 commands
More lsof commands
-
lsof -nP -p <pid> | wc -lQuick fd count to compare with ulimit -n and spot leaks; even faster: ls /proc/<pid>/fd | wc -l
-
lsof -p $(pgrep nginx) | head -30Show all files that nginx has open: regular files, sockets and pipes
-
lsof -i :8080Find which process uses port 8080
-
lsof -i -n -PShow all open network connections without resolving hosts and port names
-
lsof +D /var/logShow all processes that have open files anywhere under /var/log