I'm having some files and folders in the "My Documents" directory. What are the commands to see the size of a file and directory in a terminal?


This will summarise the sizes of the directories:

du -h

PS: Although all computer storage is technically "memory", this term is usually reserved for non-persistent storage like RAM and CPU cache.

  • good one for quick recursive results.. +1 – precise Jan 8 '14 at 15:30

To see the full size (including whole content) of a folder in a directory, use the command


To see the full size (including whole content) of all folders and files in a directory, use the command

ls | xargs -I fileorfolder du -hs fileorfolder

Try these commands,

cd ~/Documents
ls -shR
  • 1
    ls -sh for size and better readability.. and switch -R if recursive output is needed.. +1 – precise Jan 8 '14 at 15:29
  • 1
    Not completely satisfied. The size of a folder is given, but not of the total size of the content in the folder. See also this answer about the total size of a folder – loved.by.Jesus Jul 4 '19 at 11:03

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.