I used this command to display a list of all opened files of the current user on my machine :

lsof -Fn -u teeba| sort  | uniq | grep /home

The result was :

enter image description here

I want to know the total number of the opened files , is there a quick way to get that like adding option for this command,other command or whatever ?

Thanks in advance


Use wc, the option -l counts the lines:

lsof -Fn -u teeba| sort  | uniq | grep /home | wc -l

This will output 25 in your case.

Additionally you can number the lines with nl:

lsof -Fn -u teeba| sort  | uniq | grep /home | nl

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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