File size in Finder vs. Terminal: a follow-up

File size in Finder vs. Terminal: a follow-up

Regarding yesterday's item noting that the "ls -l" ls command in Terminal reports a size of 0K for a file that only has a resource fork: Several readers confirmed this, but offered

Use /rsrc Brian Duart reports that typing 'ls -l filename/rsrc' should show the correct size of a file that only has a resource fork. We tried it on the System file mentioned yesterday; it worked. It displayed "256031" instead of "0".

Use du Jeffrey Mattox and Seth Noble both suggested using the du command rather than the ls command to see "the number of 512-byte blocks allocated for the file; the result is non-zero for files that appear empty to ls. Again, this worked, yielding "504" for the System file.

Seth adds: "du reports the number of 512-byte blocks by default. To get it to report kilobytes, set the environment

Or, as pointed out by Sean Peisert, you can use "du -k" to get the number of 1024-byte blocks.


Join the discussion

Conversation powered by Livefyre

Don't Miss
Hot Products
Trending on CNET


Is your phone battery always at 4 percent?

These battery packs will give your device the extra juice to power through all of those texts and phone calls.