lsof examples

lsof -u username

Show open files by user

lsof -Pni

See which process opened a particular TCP or UDP port

lsof -i :80

Show which process opened port 80 by using the lsof command.

lsof -i

Show the active connections that are currently sending and receiving data, or are waiting for the connection to be finished.