lsof

Show networking on a port

lsof -iTCP -i :port
lsof -i :22

Show connections to a host

lsof -i@192.16­8.1.5

Find ports that are being listened to

lsof -i | grep LISTEN

Find files open by user

lsof -u <us­er>

Find files open by command

lsof -c <co­mma­nd>

Find files open by proccess id

lsof -p <pi­d>