Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
On my system:
root@NOTIFICATION:/# lsof | wc -l
root@NOTIFICATION:/# lsof -u tomcat7 | wc -l
root@NOTIFICATION:/# lsof | grep tomcat7 | wc -l
You have two different selections:
lsof -u tomcat7 lists open files belonging to tomcat7, whatever their names.
lsof -u tomcat7
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.
lsof | grep tomcat7