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

Show Comments Hide Comments
Latest Galleries from CNET
The most anticipated games of 2015
Tech industry's high-flying 2014
Uber's tumultuous ups and downs in 2014 (pictures)
The best and worst quotes of 2014 (pictures)
A roomy range from LG (pictures)
This plain GE range has all of the essentials (pictures)