擅长:python、mysql、java
<p>你可以试试这个:</p>
<pre><code>>>> import subprocess
>>> threshold = 10
>>> child = subprocess.Popen(['df', '-h'], stdout=subprocess.PIPE)
>>> output = child.communicate()[0].strip().split("\n")
>>> for x in output[1:]:
... if int(x.split()[-2][:-1]) >= threshold:
... print x
</code></pre>
<p>这将列出磁盘使用率为10%或大于10%的所有文件系统</p>