lsof – usage

The Unix lsof command lists information about files that are open by processes running on the system.

List all open files belonging to PID (process ID)
lsof -p

List all open files belonging to processes owned by the user named “name”

lsof -u al

To list all open files, use:
lsof

To list all open Internet, x.25 (HP-UX), and UNIX domain files, use:
lsof -i -U

To list all files using any protocol on any port of snowhite.cis.temple.edu, use:
lsof -i @snowhite.cis.temple.edu

To find the process that has /u/abe/foo open, use:
lsof /u/abe/foo

To find any open file, including an open UNIX domain socket file, with the
name /dev/log, use:
lsof /dev/log

To obtain PID and command name field output for each process, file descrip-
tor, file device number, and file inode number for each file of each pro-
cess, use:
lsof -FpcfDi

To find an IP version 4 socket file by its associated numeric dot-form
address, use:
lsof -i@128.210.15.17

~ by moturu on August 12, 2009.

Leave a comment