The Computer Oracle

Is there a terminal command to list folder size and corresponding file sizes within on Ubuntu 14.04 (Trusty Tahr)?

-------------------------------------------------------------------------------
Become or hire the top 3% of the developers on Toptal https://topt.al/25cXVn
-------------------------------------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Underwater World

--

Chapters
00:00 Question
00:51 Accepted answer (Score 9)
01:18 Answer 2 (Score 69)
01:49 Answer 3 (Score 7)
02:14 Answer 4 (Score 5)
02:50 Thank you

--

Full question
https://superuser.com/questions/869969/i...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#ubuntu1404

#avk47



ANSWER 1

Score 71


I like to use simply:

du -chd 1 | sort -h

It outputs the total size of each sub-directory from the current directory location (the "1" above), as well as a total of all sub-directories, and sorts it by human-readable sizes:

See how it looks here.




ACCEPTED ANSWER

Score 9


Yes, there is the tree command. Install it via sudo apt-get install tree, and type the following:

tree -h

From man tree:

-h    Print  the size of each file but in a more human readable way, e.g. appending a size letter for kilo‐
      bytes (K), megabytes (M), gigabytes (G), terabytes (T), petabytes (P) and exabytes (E).

Done :)




ANSWER 3

Score 7


I found these helpful top 10 disk usages. For quick use, the command line is the following:

du -m | sort -nr | head -10

It lists all folders (including repetitive sub-folders) with most disk space usage sorted.




ANSWER 4

Score 5


Tree is nice, and I know that might be what you asked for. I wanted to present you with something slightly different though to help you find what you are looking for (what is consuming the most space):

du -lah|grep -v -e '^.*K[[:space:]]'|sort -r -n

You can also pipe to head to just get the top list:

du -lah|grep -v -e '^.*K[[:space:]]'|sort -r -n|head

I was trying to actually give this with grep -v -e..., but it doesn't seem to be working on the output for du -lah for some reason. It should be sufficient though.