I need to get the total size of all files on a partition into a bash script. It doesn't have to be a pure number and it doesn't have to be exact, merely accurate to the last significant digit shown. For instance, it could be a string like "2.1 giB", with the unit being appropriate to the size being reported.
The best approach I've been able to come up with is to use something likebut that puts out a table 3 rows by six columns. I suppose I could figure out how to massage that output with some of the string processing commands like awk or sed. I confess I always contemplate useing those commands with a certain amount of dread but perhaps that means I need more practice.Code:df --total -h /dev/sda1
Is there some easier way? A command that will spit out something closer to what I want without embedding it in a lot of stuff I don't?