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

download - Firefox cannot save files (most of the time), how to solve? - Super User

windows - "-2146893807 NTE_NOT_FOUND" when repair certificate store - Super User

sql server - "Configuration file does not exist", Event ID 274 - Super User