lsof

View files open by PID:

lsof -p 890

View sockets by port or address

lsof -i TCP:22
lsof -i [email protected]

Inspect unix sockets, and even get their type:

~$ lsof -U | grep foo

python3   130385 mierdin    3u  unix 0x0000000000000000      0t0 1382094 /tmp/foo.sock type=SEQPACKET