[clug] Disk vs file size
Brett Worth
brett.worth at gmail.com
Thu Aug 8 07:44:20 UTC 2019
On 8/8/19 5:12 pm, Andrew Janke via linux wrote:
> Hi all,
>
> Let's say I have a filesystem that has a blocksize of 1Mb. Yes, you
> read that right. And I happened to know that there are a lot of very
> small files in there.
>
> Is there an each way to report how much disk space this is costing me?
> All I can think of is using du or ls across the thing and then back
> calculating. Also, I don't think I have df access.
How about:
$ find . -type f -ls | awk ' { sum+=$2; } END {print sum*1024*1024; } '
The second column of the -ls output is the block count so the multiplier needs to match
your block size.
Brett
--
/) _ _ _/_/ / / / _ _//
/_)/</= / / (_(_/()/< ///
More information about the linux
mailing list