小编Joh*_*ohn的帖子

使用 df 命令仅显示 %used

我发现了一些其他解决方案,例如: df -Ph /oracle/archive | awk 'NR == 2{print $5}' | tr -d '%'

但它们似乎有点太多了,我认为存在更优雅的东西,因为我将直接传递到subprocess.check_output()in python2.7

下面是一个输出示例df

Filesystem     1K-blocks    Used Available Use% Mounted on
/dev/root        7508524 4890644   2258240  69% /
Run Code Online (Sandbox Code Playgroud)

我只想获得69价值。

谁能帮我吗?

非常感谢

python linux bash shell grep

2
推荐指数
2
解决办法
7521
查看次数

标签 统计

bash ×1

grep ×1

linux ×1

python ×1

shell ×1