User Tools

Site Tools


du_vs_ls

du vs ls

Why is ls and du showing different sizes?
When there is a difference in sizes between the two commands it means that the file is a sparse file:

TL;DR

ls is reporting the allocated size
du is reporting the space actually used


Sparse File

A sparse file is a file that is mapped to use a certain amount of space but may not currently be using that space.

Source:
https://en.wikipedia.org/wiki/Sparse_filehttps://en.wikipedia.org/wiki/Sparse_file

du_vs_ls.txt · Last modified: 2024/05/23 07:26 by 127.0.0.1