I have been using the du
command to get the size of a directory:
du /tmp/dir1
This produced the total size of the files:
7 /tmp/dir1
Which I then parse and use the details.
This folder is full of .txt
and txr
files.
I am only interested in the total size of the *.txt
files.
Is there a way I can odify the du
command to produce a single line output of the size of just the *.txt
files?
Pass a list of files to the
du
command. For example:A possible solution to getting only the total size is to get the last line of
du
's output, as in: