29
Jul 2009

The Powerful lsof

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:

  • To list all open TCP sockets with port numbers:
    sudo lsof -i -P
  • To find processes open a folder or any file in that folder
    sudo lsof +D /the/foler
  • To find process open any file on a dev
    sudo lsof /dev/disk0s2
  • To print all found process id only
    sudo lsof -t <other commands>

Details can be looked up in the man page.

comments powered by Disqus