Skip to main content

lsof

Network Port

What process is using the port 50000

lsof -i :50000

lsof -i :https

lsof -i tcp:25

lsof -i udp:53

lsof -i :1-1024

lsof -i udp
Mount Point

What process is using the mount-point

lsof | grep /path/to/mount-point

lsof +f -- /path/to/dir

lsof +D /path/to/dir

# List all NFS files
lsof -N
Process

What files and directories are using by the process

lsof -p `pidof <app_name>`

lsof -c apache

lsof | grep apache

# list Parent PID of processes
lsof -p [PID] -R
User
# List files opened by processes belonging to a specific user
lsof -u [user-name]

lsof -a -i -u www-data
IP & Domain

List files based on their Internet address

# For IPv4
lsof -i 4

# For IPv6
lsof -i 6
File
lsof -t [file-name]
lsof -t /usr/lib/x86_64-linux-gnu/libpcre2-8.so.0.9.0
Memory
lsof -d mem