-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
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.

Not the answer you're looking for? Browse other questions tagged or ask your own question.