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

How can I know the size of all tmp folders for all users.

I tried

du -h /home/*/tmp

But it did not add them all together.

share|improve this question
up vote 2 down vote accepted

If you have GNU du, the -c flag should do what you want.

$ du -hcs /home/*/tmp


3.9M total

You can trim to the final total by using tail:

$ du -hcs /home/*/tmp | tail -1
share|improve this answer
Seems wasteful to list all sub dirs and then trim, should use du -hcs /home/*/tmp | tail -1 – user2354329 May 23 '13 at 7:58
@user2354329 -s makes no difference in the output when using tail afterwards, and realistically makes no difference in the speed of execution. You will spend more time typing s than the time it will save. – Chris Down May 23 '13 at 8:15

Not sure what exactly your question is about.

Maybe you simply want:

du -hs /home/*/tmp
share|improve this answer
Yeah, but it does not add them all together. – OOzy Pal May 23 '13 at 7:41

If you just want the total amount the easiest is probably:

du -shc | tail -1
share|improve this answer

It is simple command

 du -sh /tmp
share|improve this answer
Although there might be user data there as well, this does not add up the amounts in the directories indicated by the OP. – Anthon May 23 '13 at 8: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.