-3

On my system:

root@NOTIFICATION:/# lsof | wc -l
24187
root@NOTIFICATION:/# lsof -u tomcat7 | wc -l
224
root@NOTIFICATION:/# lsof | grep tomcat7 | wc -l
20646
terdon
  • 234,489
  • 66
  • 447
  • 667
  • 1
    Possible duplicate of [Discrepancy with lsof command when trying to get the count of open files per process](http://unix.stackexchange.com/questions/199479/discrepancy-with-lsof-command-when-trying-to-get-the-count-of-open-files-per-pro) – Stéphane Chazelas Nov 11 '15 at 15:10

1 Answers1

4

You have two different selections:

  • lsof -u tomcat7 lists open files belonging to tomcat7, whatever their names.

  • lsof | grep tomcat7 lists open files with tomcat7 in their name ( or as a string in the line, be it user or group) irrespective of their owners.

Archemar
  • 31,183
  • 18
  • 69
  • 104