We can list only files opened by a specific PID as
lsof -p 1000
lsof -p 1000 | wc -l
How can we list/count the files opened by a specific program/COMMAND (e.g., java)?
And so much better, if we can group the number of open files for each program. I want to inspect which programs have high numbers of opened files.
I want something like
lsof -c "java" # -c is an imaginary argument similar to -p for process
I use Ubuntu 20.04.
lsof
as this may slightly different on other OS – alecxs Jan 25 '21 at 20:42java
command. – Googlebot Jan 26 '21 at 23:06