lsof
What is the purpose of the -b option?
avoid blocking operation
lsof -b
How can we use lsof to display a list of files in a directory that is currently opened?
lsof /mnt
How can we use lsof to display a list of files that are opened by a particular process?
lsof -p 1234,1235,1236
The above command display files that are opened by the given process IDs.
How can we use lsof to display listened ports?
lsof -i -nP
lsof -i tcp:23
How can we use lsof to list open sockets without looking up host names and services?
lsof -i -nP tcp:80
How can we use lsof to display a list of files opened by a given user?
Use the -u option:
lsof -u username
How can we use lsof to display a list of processes that has a particular file opened?
lsof /path/to/file
How can we use lsof to display a list of open files for matching processes?
lsof -c command
page revision: 2, last edited: 15 Aug 2017 21:12