4

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.

2

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
  • 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
  • 1
    @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
0

Not sure what exactly your question is about.

Maybe you simply want:

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

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

du -shc | tail -1
0

It is simple command

 du -sh /tmp
  • 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 clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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