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

debian - Kali Linux - Debootstrap error Failed to determine codename for the release - Super User

crash - Windows Rundll32 (child process of DllHost) is crashing. How can I even identify it? - Super User

Windows XP installation, no previous version of Windows NT - Super User