Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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

4 Answers 4

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
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

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

 
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.