List open files of a process
Show all files that nginx has open: regular files, sockets and pipes
lsof -p $(pgrep nginx) | head -30
- tool
- lsof19 commands
More lsof commands
-
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
-
lsof | grep '(deleted)'Find files that were deleted but are still open in a process and still use disk space
-
ss -tlnpShow listening TCP ports with process names