This is a nifty small feature . Tools like ps,df,du, ls,ps,size,prstat and swap have now the option --scale. This makes the output of those tools much more readable.
Let’s assume we have a directory with three files of varying size:
This is a little cumbersome to read despite the experienced admin will recognize at least two numbers. The --scale command allows me to control how the output is scaled in a more human readable format.
Let’s at first use a scaling factor of 1024. Values are scaled by dividing by 1024. how often is controlled by the min i have put in front of the 1024. I will later explain the impact off this value.
Of course you could scale with a factor of 1000 as well.
If you chose binary scaling, the Unit will be appended with an “i” to make clear that we are talking about Mebibyte oder Kibibyte.
The unit to which the the numbers are scaled by dividing with the scale factor is set with min, max or minwide.
Min will scale each value to the minimal unit that allows the system to display a value in 5 digits.
max uses the highest unit that allows the to have a nonzero value in front of a possible decimal. It tries to make the number in front of the unit as low as possible and tries to fit in 5 digits.
minwide is similar to min,except that it tries to fit the the size output in eight instead of five columns
This is a nice demonstration of minimal scaling, as the size of testfile fits in eight columns without scaling the value isn’t scaled at all.
You can use --scale as well with prstat
du is one additional tool that supports this option: