Celeb Glow
updates | February 26, 2026

Total folder size with ls -lh

I created a directory where I put ten files, each one with exactly 1,048,576 characters (1024^2). The size of each one of them should be exactly one megabyte, counting megabyte as 1024^2 bytes.

If I use ls -lh on that directory, this is the output

[ me: /home/me/test ] ls -lh the_directory
total 11M
-rw-r--r-- 1 me we 1.0M Feb 1 17:11 f0
-rw-r--r-- 1 me we 1.0M Feb 1 17:11 f1
-rw-r--r-- 1 me we 1.0M Feb 1 17:11 f2
-rw-r--r-- 1 me we 1.0M Feb 1 17:11 f3
-rw-r--r-- 1 me we 1.0M Feb 1 17:11 f4
-rw-r--r-- 1 me we 1.0M Feb 1 17:11 f5
-rw-r--r-- 1 me we 1.0M Feb 1 17:11 f6
-rw-r--r-- 1 me we 1.0M Feb 1 17:11 f7
-rw-r--r-- 1 me we 1.0M Feb 1 17:11 f8
-rw-r--r-- 1 me we 1.0M Feb 1 17:11 f9

Why does it add up to 11M if the sum of the colum is exactly 10.0M? If I do ls -lha, then I see that the directories . and .. account for 4KB each. There is NOTHING else in this directory.

Why is this so?

This was done in a Linux box.

1 Answer

It is because there are two additional 4K entries (. and ..), a small 4K overhead on each file (it's the metadata block) and ls always rounds sizes up.

Try ls -lash (it will show the 'disk' size of files, i.e. with any additional non-user-data stored on disk):

total 11M
4.0K drwxr-xr-x 2 whitequark whitequark 4.0K 2010-02-02 06:15 .
4.0K drwxr-xr-x 85 whitequark whitequark 4.0K 2010-02-02 05:33 ..
1.1M -rw-r--r-- 1 whitequark whitequark 1.0M 2010-02-02 06:15 f0
...
1.1M -rw-r--r-- 1 whitequark whitequark 976K 2010-02-02 06:20 f9

If you'll request size in kilobytes with ls -las, you'll get:

total 10288 4 drwxr-xr-x 2 whitequark whitequark 4096 2010-02-02 06:15 . 4 drwxr-xr-x 85 whitequark whitequark 4096 2010-02-02 05:33 ..
1028 -rw-r--r-- 1 whitequark whitequark 1048576 2010-02-02 06:15 f0
...
1028 -rw-r--r-- 1 whitequark whitequark 1048576 2010-02-02 06:18 f9

Also, if you'll reduce size of last file by 48K (the overhead), you'll get a 10M (i.e. 10240K) directory:

total 10M
4.0K drwxr-xr-x 2 whitequark whitequark 4.0K 2010-02-02 06:15 .
4.0K drwxr-xr-x 85 whitequark whitequark 4.0K 2010-02-02 05:33 ..
1.1M -rw-r--r-- 1 whitequark whitequark 1.0M 2010-02-02 06:15 f0
...
1.1M -rw-r--r-- 1 whitequark whitequark 1.0M 2010-02-02 06:15 f8
980K -rw-r--r-- 1 whitequark whitequark 976K 2010-02-02 06:20 f9
1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy