How to find how much space a file is really taking

published: 01 Mar 2005 | tags:

Azerus the bittorrent client creates a sparse file for every file in the torrent you are downloading. I had a 52GiB torrent I only wanted 10 files from. When it got done ls -l couldn’t tell me which files had stuff in them.

After searching for a way to find out if a file makes use of the sparse file trick I discovered that it’s quite possible that any file that has nulls in it might be sparse. Oh great…

du turned out to actually show how much space on disk the file was taking. I couldn’t find anything that linked du to sparse files so… here it is.