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.

I like tree it's a nice way to display my files and the size of folders/directories. But the -h option only shows the size of the directory, not it's contents.

/media/
├── [ 16K]  64D9-E862
│   ├── [8.0K]  downloads

I know for a fact that my external drive has more that 16kB in it.

How can I fix that with tree 1.5? Better yet how do I upgrade to 1.6?

share|improve this question

1 Answer 1

up vote 13 down vote accepted

Only for tree 1.6 and above

You might want to look at:

man tree

--du For each directory report its size as the accumulation of sizes of all its files and sub-directories (and their files, and so on). The total amount of used space is also given in the final report (like the 'du -c' command.) This option requires tree to read the entire directory tree before emitting it, see BUGS AND NOTES below. Implies -s.

share|improve this answer
    
I'd missed that one. I can't see it in my version of man tree I have -u Print the username, or UID # if no username is available, of the file. and -d Print the username, or UID # if no username is available, of the file. –  Pureferret Aug 19 '12 at 12:57
    
@Pureferret what OS? –  msys Aug 19 '12 at 13:00
    
Ubuntu 12.something –  Pureferret Aug 19 '12 at 13:03
1  
@Pureferret Thats another question. The short story, download, compile and run. start here launchpad.net/ubuntu/+source/tree/1.6.0-1 if you need further help ubuntu have there own stack exchange askubuntu they may be best to help. –  msys Aug 19 '12 at 13:24
1  
This for pointing to --du in 1.6. I always use du -h --max-depth= 1 or 2 or maximum 3. Then drill down (cd) into where I want to go, and run the same command agin. When tree is used with -L it counts only directories/and files up to a given level. Comapred to du which calculates all files irrespective of --max-depth parameter, but just prints up to a specified level. It makes tree not helpful for me. Thanks though! –  Ruslan Jul 2 at 4:20

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.