lsof is used to list open files (e.g. lsof /tmp) but can also be used to list open ports. Once you know what pid holds the open port you’re interested in, there are a few different tools to figure out what the process actually is.

  1. lsof -i TCP:1234 returns the pid of the process with the given port open.
  2. If ps or (for Java programs) jps don’t give a useful program name, pwdx can be used to find the program’s working directory, which can be useful.