Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
up vote 4 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 '14 at 18:45

Your Answer


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.