What’s the best way to list size of / in Terminal

directoryfdiskls

I want to see how much total space / is taking, but I don't know how to do that. I can use ls -hal and add up the subtotals, or I can use fdisk to tell me the size of that partition, but is there a better way?

Best Answer

Are you asking about the total size of files/directories contained within /, or the total size of the root filesystem?

If the former, use df -h /.

If the latter, you can do this with du -sh /, which will be very slow, as it has to enumerate every single file. Better, but possibly inaccurate due to things like bind mounts, filesystems stored as sparse files on other filesystems/etc: total up your df output.

Related Question