Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

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

This command:

$ time (\ls /path/to/lots/of/dir*/*/*/*.ext > inputs.txt )

real    1m9.064s
user    1m3.265s
sys     0m5.993s

Gives me a huge list of file names inside the file "inputs.txt".

I need to know the total size of all files described in inputs.txt, preferably without list all of them.

share|improve this question

You need to use the option -c of du:

du -csh /path/to/lots/of/dir*/*/*/*.ext

To show only the final count, you can use tail -n 1:

du -csh /path/to/lots/of/dir*/*/*/*.ext | tail -n 1
share|improve this answer

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.