How can I see the memory occupied by a file and folder and also entire directory from 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.


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

du -hs YOUR_FOLDER_NAME

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