I understand the size reported by ls
corresponds with number of inodes inside the directory, not their actual size.
I have noticed peculiar behavior, when displaying directory size with ls
. Here is how to quickly reproduce it:
first create empty directory, the size reported by ls
is 4096 (as expected)
mkdir test
ll -d test/
drwx------ 2 root root 4,096 2015-Dec-29 22:22:36 test/
create 10,000 files inside. Size reported is now 167,936
touch test/{1..9999}
ll -d test/
drwx------ 2 root root 167,936 2015-Dec-29 22:23:24 test/
remove all files. Size should decrease back to 4096
rm test/*
ll -d test/
drwx------ 2 root root 167,936 2015-Dec-29 22:23:59 test/
But the size is still reported as 167,936.
why?
can somebody explain this?