Skip navigation.
Your source for Perl tips, howto's, faq and tutorials
( categories: | )

Use ls -l to get the list of files you want to sum and pipe the result to a perl one-liner that sums the fifth column of every line it processes.

For example, to get the total size of all your .rpm files in your current directory, use the following:

ls -l *rpm | perl -lane '$total += $F[4]; END { print "Total: $total bytes\n" }'