The lsof
command will show all files that are open for each process. The following will aggregate the results into a table that shows the number of tiles opened per process:
lsof | awk '{print $2,$1}' | sort | uniq -c | sort -r -n | head
The first column is the file count, the second is the PID, and the third is the process name. Works in both Linux and macOs.
ss -plunt
or
netstat -plunt
ss
is generally preferred over netstat
(netstat
has been deprecated on Linux for a long time).
Note the macOS version of netstat does not have these options. The closest we have in macOS is:
lsof -iTCP -iUDP -nP
jcmd # will report PID of all Java processes jcmd <pid> GC.heap_info | grep -oP "heap *total .*? used .*? "