Count open fds of a PID
Quick fd count to spot leaks vs ulimit -n; faster: ls /proc/<pid>/fd | wc -l
lsof -nP -p <pid> | wc -l
- tool
- lsof19 commands
More lsof commands
-
lsof -p $(pgrep nginx) | head -30Show all files (sockets, regular, pipes) opened by nginx
-
lsof -i :8080Find which process is listening on port 8080
-
lsof -i -n -PShow all open network connections without DNS resolution
-
lsof +D /var/logShow all processes with open files under /var/log
-
lsof | grep '(deleted)'Find files deleted but still held open by processes (disk bloat)