lsof can list all open files in osx. As directories, sockets are all also files in unix. lsof can also be used to find open ports/sockets/directories:
sudo lsof -i -P
sudo lsof +D /the/foler
sudo lsof /dev/disk0s2
sudo lsof -t <other commands>
Details can be looked up in the man page.