Real size of folder?
When I run du -hs Folder
in the terminal I get: 118M
When I run du -s Folder
in the terminal I get: 120664M
When I run du -h Folder
in the terminal I get: 118m
When I find the size through the file explorer (right click -> properties) I get: 65.5M
So, which is the correct one and why does this happen?
Solution 1:
Your second output, du -s Folder
is in kilobytes not megabytes. That is the default output for du
. To convert to MB divide by 1024: 120664/1024 = 117.8359375, with the h
flag this gets rounded up to 118MB.
You can also view the size of the folder in Bytes with du -sb Folder
.
The du utility gives you the amount that is actually used by the disk. The value you are seeing in the file explorer is the apparent size. These are not the same as explained in man du
:
--apparent-size
print apparent sizes, rather than disk usage; although the apparent size is usually smaller, it may be larger due
to holes in (`sparse') files, internal fragmentation, indirect blocks, and the like
If you use --apparent-size
option in du
it will give you the same value that you see in the file explorer.
As for why size on disk is different than the size of all the files, see this response: Why is disk usage greater than the size of all files on it?