5

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

1 Answer 1

7

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
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .