Why do du and Finder show different sizes for the same folder
Run du -sh on a folder and compare it to the size in Finder, and the two often come out different, sometimes by several gigabytes. Neither one is wrong. They answer different questions: how long are the files, and how much disk space do they take up. When the disk is full, only the second question matters, and to get it right, it's not enough to just add up st_size. The rules below are from the osFoundry desktop app…
The article discusses the difference between the apparent size of files and the actual disk space they occupy. It explains that the `du` command and the Finder often show different sizes for the same folder, with `du` counting the actual disk space used and the Finder showing the apparent size. The article provides examples of how this difference can occur, including with small files, sparse files, and hard links. It also describes how the `osFoundry` desktop app's Disk screen calculates disk usage.
Written by urgent.news from Dev.to's report — not a translation of it. Machine-written — may contain errors; check the original before relying on it.