lsof
-b    // avoid blocking operation

Show files in /mnt that are opened:

lsof /mnt

Show files opened by particular process:

lsof -p 1234,1235,1236

Show listened ports:

lsof -i -nP
lsof -i tcp:23

List open socket without lookups on hostname and services:

lsof -i -nP tcp:80

Show files opened by given user:

lsof -u username

List processes that has this file open:

lsof /path/to/file

List open files for matching processes:

lsof -c command
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License