Skip to content

date 2025-03-08 000858 title lsof description List Opening Files hide toc #level classified


List Opening Files


To list all IPv4 network files

sudo lsof -i4

To list all IPv6 network files

sudo lsof -i6

To list all open sockets

lsof -i

To list all listening ports

lsof -Pnl +M -i4

To find which program is using the port 80

lsof -i TCP80

To list all connections to a specific host

lsof -i@192.168.1.5

To list all processes accessing a particular file/directory

lsof <path>

To list all files open for a particular user

lsof -u <username>

To list all files/network connections a command is using

lsof -c <command>

To list all files a process has open

lsof -p

Show listening tools

lsof -i -sTCPLISTEN

Show ip-addresses connected to a port

lsof -i 443

Show ip-addresses connected to a port by ip-number

lsof -iTCP -sTCPLISTEN -P -n