Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the '"$BLOCKSIZE" Environment Variable' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
"$BLOCKSIZE" Environment Variable
Authored by: OneTrueDabe on Jul 02, '03 09:52:17PM

Note that the Mac OS X Unix utilities honor the "BLOCKSIZE" environment variable. Setting this to "1k" will effect not only "du", but also "df" (for filesystem usage) and the "-s" flag to "ls" ("ls -s" normally shows the number of 512-byte blocks, which is twice the number of kilobytes[*]) as well as any other applications which support it.

In tcsh:

setenv BLOCKSIZE 1k

... in bash:

export BLOCKSIZE=1k

... to get consistent output across "du", "df", and "ls -s".

* - The numbers reported in the first column of "ls -s" may be different from the size reported when you don't use the "-s" flag.

In the case of some Quicktime movies, for example, the size reported is 2GB, but the movie file itself only takes up a few hundred megabytes on disk. This is called a "sparse file", and simply allows the programmer to create a huge empty file ahead of time, then "fill it in" as she goes.



[ Reply to This | # ]