Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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

share|improve this question

1 Answer 1

up vote 3 down vote accepted

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
share|improve this answer
    
thank u so much ^_^ –  Akari Feb 14 at 18:45

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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