Getting file sizes

Ted Roche tedroche at tedroche.com
Mon Oct 22 09:34:00 EDT 2007


Kent Johnson wrote:
> Newbie question:
> 
> How can I get the total size, in K, of all files in a directory that 
> match a pattern?
> 
> For example, I have a dir with ~5000 files, I would like to know the 
> total size of the ~1000 files matching *.txt.
> 
> On RHEL and bash, if it matters...
> Thanks,
> Kent
> _______________________________________________

To get the result in K, specify:

du -c --block-size=1024 *.txt

or your choice of what you think K means ;)

man du tells more.

-- 
Ted Roche
Ted Roche & Associates, LLC
http://www.tedroche.com


More information about the gnhlug-discuss mailing list