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?
3 Answers
This will summarise the sizes of the directories:
du -hPS: Although all computer storage is technically "memory", this term is usually reserved for non-persistent storage like RAM and CPU cache.
1To see the full size (including whole content) of a folder in a directory, use the command
du -hs YOUR_FOLDER_NAMETo 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 -shR2