2

I have a directory, inside that, I have created 2 files and have written some content in these files when I run ls -l. It still displays the total as 0. Why? It should return some positive integer.

I already referred to this answer, and I am convinced with the explanation. But why total 0, I still didn't understand.

I am running this command in ubuntu (20.04 LTS) using Windows Subsystem for Linux on Windows 10.

ls output

2 Answers2

3

I suppose that's because you're using WSL on a NTFS volume. NTFS will store small files directly in file's record inside MFT (Master File Table). For larger files this space in a file record would be reserved, but not used. So a small file is essentially taking no extra space on disk, except for what the file record would take anyway, therefore producing a total of 0.

gronostaj
  • 58,482
0

What is "total" in the output of "ls" command? [duplicate]

total shows disk usage, not item count inside the directory!

The "total" is the disk usage of listed files (because of -a including the . and .. entries) in blocks (1024 bytes or if POSIXLY_CORRECT is set in 512 bytes), not including the content of subdirectories.