7

Finder shows different sizes for my files as compared to Terminal

Finder

-rw-r--r--@ 1 yuku  staff   4576265 Aug  6  2014 af-afr.yet
-rw-r--r--@ 1 yuku  staff   1804227 Aug 11  2014 alp-alune5.yet
-rw-r--r--@ 1 yuku  staff   8348051 Jul 24  2015 ar-nav.yet
-rw-r--r--@ 1 yuku  wheel   4683564 May  8  2015 ar-vandyke.yet
-rw-r--r--@ 1 yuku  staff   1169397 Aug  6  2014 arc-pst.yet
-rw-r--r--@ 1 yuku  staff   2545947 Aug  6  2014 awa-awbtc.yet

You can see the difference is very significant (e.g. 6 MB vs 4576265 bytes). The one at Terminal is the correct one, since if I open the files with Sublime Text and count the bytes, or attach the files in Gmail, they will show the same sizes as the Terminal ones.

If I open the file Info window, it shows the wrong size as well.

Info

This has been months, even after rebooting. I am using macOS 10.13 High Sierra. Do you know what is the source of this error and how to fix it?

2
  • confirmed. it also happened to my mac. there is file size difference between finder and ls -lh from terminal
    – aldok
    Jan 19, 2018 at 3:27
  • I could be totally wrong about this but I thought mac creates a hidden folder that mirrors the actual folder and sometimes it contains different things. This causes big headaches copying files from mac to windows because it doesn't pickup the hidden folders. Anyway maybe thats the filesize with and without the hidden folders. Jan 19, 2018 at 15:42

1 Answer 1

1

Actually, the answer is in your "Get Info" window:

GetInfo Size

You've got compression enabled on that drive. The file does have 6MB data in it, and when you copy it elsewhere, that's what it takes up.

However, with compression enabled on that drive, the file only takes up 2.9MB on the disk because it has been compressed.

7
  • Yes, but terminal shows 4MB+, which is neither near to 6MB or 2.9MB. Jan 25, 2018 at 18:03
  • I see the same issue with an uncompressed disk (ls: 19.146.711bytes, get info: 19.146.997 bytes (19,2 MB on disk)) Apr 20, 2018 at 7:07
  • @AdamMichalik -- You're just seeing the difference between bytes and megabytes. The numbers you posted are all the saying the same thing. 1Kilobyte=1024bytes, and 1Megabyte=1024Kilobytes. So 19,146,711 / 1024 / 1024 = 18.2Megabytes. You'll notice a discrepancy of 1MB, and that
    – le_jawa
    Apr 20, 2018 at 14:17
  • Stinkin' 5 minute edit limit. Here's what I wanted to say: 1: you're looking at sizes reported in bytes and Megabytes. 1Kilobyte=1024bytes, and 1Megabyte=1024Kilobytes. So 19,146,711 / 1024 / 1024 = 18.2Megabytes. There's a discrepancy of 1MB;that's #2: File systems store data in blocks, so the space a file takes up is almost always more than its actual size. For example, a 5K file needs two 4K blocks, therefore taking up 8K of disk space. When a file is fragmented, it becomes even less efficient; causing it to take up even more space on disk. That's where your extra 1MB is going.
    – le_jawa
    Apr 20, 2018 at 14:35
  • @le_jawa: I would get it if the discrepancies were on the byte vs. megabyte level. But notice that it's bytes vs. bytes: ls: 19.146.711 bytes, get info: 19.146.997 bytes. This I cannot understand. Apr 20, 2018 at 14:49

You must log in to answer this question.

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