I made a dumb linux mistake

Alex Woods

Alex Woods

July 27, 2021


ls -lh does not get you the file size for directories. It shows the amount of disk space used to store metadata for that directory.

Let's see the example I screwed up this week!

$ ls -lha
...
drwxr-xr-x     3 alexwoods  staff    96B Jul 25 11:59 .yarn
drwxr-xr-x  2239 alexwoods  staff    70K Jul 25 12:07 node_modules

"Wow, why is our cache taking so long, that's not that much data...."

$ du -sh .yarn node_modules
1.4G	.yarn
1.5G	node_modules

Oh, that's why 🤦‍♂️.

Sources

  1. https://unix.stackexchange.com/questions/55/what-does-size-of-a-directory-mean-in-output-of-ls-l-command
  2. https://linuxize.com/post/how-get-size-of-file-directory-linux/

Want to know when I write a new article?

Get new posts in your inbox