I made a dumb linux mistake

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!

Terminal window
$ 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…”

Terminal window
$ 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/

Wow! You read the whole thing. People who make it this far sometimes want to receive emails when I post something new.

I also have an RSS feed.