If you need to output using "human friendly" units, make the conversion after sorting (perhaps using awk).
AWK Script: This is how we can sort the files .. don't know if we can using the -h option but this is kinda like simulating the -h option. Results are more accurate ;)
发布评论
评论(2)
使用 GNU Coreutils >= 7.5:
在 Mac 上OS X 使用自制程序安装 coreutils 很容易:
来自 https://serverfault.com/questions/62411/how-can- i-sort-du-h-output-by-size
Using GNU Coreutils >= 7.5:
On Mac OS X it's easy to install coreutils with homebrew:
From https://serverfault.com/questions/62411/how-can-i-sort-du-h-output-by-size
我不太明白这个问题。为什么没有排序?
编辑应该要求相同的单位,例如
du -k
总是千字节如果您需要使用“人类友好”单位输出,请在排序后进行转换(也许使用<代码>awk)。
AWK 脚本:这就是我们对文件进行排序的方式..不知道我们是否可以使用
-h选项
,但这有点像模拟- h 选项
。结果更准确;)I don't quite understand the question. Why isn't is not sorted?
edit should ask for the same unit, e.g. always kilobytes with
du -k
If you need to output using "human friendly" units, make the conversion after sorting (perhaps using
awk
).AWK Script: This is how we can sort the files .. don't know if we can using the
-h option
but this is kinda like simulating the-h option
. Results are more accurate ;)