How to Investigate the Usage of a TCP Port on Mac

I am getting an error that a port I am try to link in a docker-compose is being used by something else.

I can see my ports that are listening using suggested commands from here: How can I list my open network ports with netstat?

In my terminal I'm getting something looks approximately like the below:

Command   Pid         User     Fd    Type Device             Size/Off  Node    Name
java      343        _hivesvc  179u  IPv6 0x31e0f5f4193134b3      0t0  TCP     localhost:8999 (LISTEN)

How can I further investigate what is utilizing this port? I assume the Device is the detail I'm looking for? But the hexadecimal hash doesn't tell me anything I can interpret.


You can run ps -xEf -p PID to see details about the process.