Sum file size in Unix

Apr 14, 2025
1 min read
To sum size of all files of a certain name type :-
For example, we want to know the sum of all files having a common name "access.log"
ls -lrt access.log* | awk '{ sum += $5 } END{ printf "%0.2f\n", sum/(1024*1024*1024) }'
The above command gives the output in GB
Comments