When using the ls -lSh command, the output of the size of the files is very small. For instance:
ls -lSh | grep Xcode.app #my command to terminal while in Applications directory
drwxr-xr-x@ 3 root wheel 96B Dec 17 14:59 Xcode.app #output
As you can see, Xcode is only 96B, when in reality is over 6GB on disk. Can somebody please explain the formula being applied here?
I am running iTerm2 on macosx catalina
ls
does not report size of whole directory, but only the directory entry itself. If you want aggregate directory size, you should use du
or similar utilities that count sizes recursively. The size output from ls
is the size of the directory entry, which generally grows if you have more files and subdirectories, but not when you have large single files, and depends a lot on the underlying filesystem.