You will find here all my posts, if you like what you read, do not hesitate to add my Rss flux (yes, the icon up there) or share the content.

April 20, 2012

Multiple text file size : small intro to find and awk

People are used to just open a file explorer, select multiple files, right click and check size. Unfortunately you can’t do that when you work in a terminal through an ssh connexion. In bash, one can do the following to track the size of all the files harboring a final .txt : find ./ -name "*.txt" -ls | awk '{total += $7} END {print "Total size: " total/1024/1024 " Mb"}' There are other commands to get this done, this is one I like because I can easily specify a file pattern that I am looking for. Read more

Copyright 2025 - Mikael Koutero. All rights reserved.

Privacy Statement