command line - How to capture disk usage percentage of a partition as an integer? - Ask Ubuntu


i method capture disk usage of particular partition, using directory partition mounted. output should integer no padding or following symbols, i'd save in variable.

i've used df --output=pcent /mount/point, need trim output has unnecessary header, single space padding before value, , % symbol following value so:

use%  83% 

in case output 83. i'm not aware of drawbacks using output of df, happy accept other methods not rely on it.

i'd use...

df --output=pcent /mount/point | tr -dc '0-9' 

not sure if sed faster, can't ever remember sed values.


Comments

Popular posts from this blog

drivers - No wi-fi network after install - Ask Ubuntu

unity - Double Triple-Click brings up Switcher -- how do I change this to revert Triple-Click to be middle click again? - Ask Ubuntu