Difference in size shown by "du" command and "get info" on Mac OS X [closed]
Want to improve this question? Update the question so it开发者_C百科39;s on-topic for Stack Overflow.
Closed 11 years ago.
Improve this questionRun the command "du -ch /Applications" on terminal, note down its size.
Now look at the size of /Applications folder from "Get Info" option. There is a major difference size shown. Same is true for any other folder. What is the reason for this difference, which one of it is the exact size?In recent OS X versions Finder uses base 10 (1 MB = 1000 KB, etc) as storage manufacturers do, rather than base 2 (1 MiB = 1024 KiB) as du -h
does.
This is a duplicate of this SuperUser question - hopefully it can be closed as duplicate once it's moved...
Do you use the system provided du
, or some du
you installed from the source?
The vast difference in the size shown can be because of the file system compression, not seen by some of the BSD tools. It basically works by putting a compressed version of a file in the resource fork of the file, keeping the data fork empty. When the file is read, the content is automatically decomporessed. But some of the BSD API reports the bare size of the data fork, thus missing the size of the real data in the resource fork.
See this explanation for more details.
I believe the standard /usr/bin/du
takes care of this file system compression, so if you do not use MacPorts or Fink to install an old version of du
this should not be the cause of the problem ...
精彩评论