4

I have a folder of font files that are ~30KB in size each. Finder shows this information correctly, but when I go to Terminal, it shows the files as each having a size of 0KB.

enter image description here

ls -ltarh
total 1008
-rwx------@  1 danrumney  staff     0B Jun  4  2002 GothaBol
-rwx------@  1 danrumney  staff     0B Jun  4  2002 GothaLigIta
-rwx------@  1 danrumney  staff     0B Jun  4  2002 GothaLig
-rwx------@  1 danrumney  staff     0B Jun  5  2002 GothaMedIta
-rwx------@  1 danrumney  staff     0B Jun  5  2002 GothaMed
-rwx------@  1 danrumney  staff     0B Mar 31  2003 HTF Gotham™
-rwx------@  1 danrumney  staff     0B Feb  5  2006 Gotham-Bold
-rwx------@  1 danrumney  staff     0B Feb  5  2006 Gotham-Medium
-rwx------@  1 danrumney  staff     0B Jun 17  2009 Gotham-Ultra
-rwx------@  1 danrumney  staff     0B Jun 17  2009 Gotham-Book
-rwx------@  1 danrumney  staff     0B Jun 17  2009 GothaUlt
-rwx------@  1 danrumney  staff     0B Jun 17  2009 GothaBoo
-rw-r--r--@  1 danrumney  staff   6.0K Mar 14 12:24 .DS_Store
drwxr-xr-x@ 12 danrumney  staff   384B Mar 17 09:50 ..
drwxr-xr-x@ 15 danrumney  staff   480B Mar 17 09:50 .

There are plenty of questions and answers around Finder showing different sizes to the Terminal, but in those, the Terminal tends to be the correct one - this appears to be the opposite.

Why the discrepancy here?

  • If you add -O, does it show those files as being compressed? I seem to remember du reports compressed files as size zero, but I don't know about ls. – calum_b Mar 17 at 17:07
  • Nope. Just a - – Dancrumb Mar 17 at 18:10
5

My guess would be that the content of those files are hidden away in the resource fork, and that ls only shows the size of what’s visible to standard Unix API:s.

If this is the case, you should be able to see the “hidden” bytes by doing

ls -l *filename*/..namedfork/rsrc
  • Ok, extended attributes, then? Apparently, ls -@ is supposed to show those. – Ture Pålsson Mar 17 at 19:16
  • @Gordon Davisson, Sorry about that, I misread the source which was talking about the shorter form filename/rsrc being completely removed in Mac OS X v10.7. – user3439894 Mar 18 at 6:10
  • The command ls -l@ confirmed that this was indeed the issue. – Dancrumb Mar 23 at 22:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .