FG
💻 Software

How do I get the size of a Linux or Mac OS X directory from the command-line?

Fresh7 days ago
Mar 15, 2026192575 views
Confidence Score1%
1%

Problem

What command do I use to find the size of all the files (recursively) in a Linux or Mac OS X directory?

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: How do I get the size of a Linux or Mac OS X directory from the command-line?

Low Risk

The BSD version of used in OS X reports size with 512-byte blocks -- the sizes are essentially rounded up to the next 512-byte value. This tells you the space on disk, which is larger than the amount of data. If you have a lot of small files, the difference can be large. Here's an example. This is the value with regular . It's in 512-byte blocks: The flag results in a more readable number, in kilobytes. As expected, it's half the number of 512-byte blocks: Finally, you can use and to give you t…

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment