就个人而言,我只是将其与GNU sort的功能结合在一起:
du -ch | sort -h
这将导致尺寸以人类可读格式进行排序。例如:
$ du -h /usr/ | head -20 | sort -h
8.0K /usr/src/linux-headers-3.2.0-3-common/include/misc
12K /usr/src/linux-headers-3.2.0-3-common/include/drm/i2c
12K /usr/src/linux-headers-3.2.0-3-common/include/net/netfilter/ipv4
16K /usr/src/linux-headers-3.2.0-3-common/include/net/netfilter/ipv6
20K /usr/src/linux-headers-3.2.0-3-common/include/net/phonet
28K /usr/src/linux-headers-3.2.0-3-common/include/acpi/platform
52K /usr/src/linux-headers-3.2.0-3-common/include/net/netns
60K /usr/lib32/libv4l
76K /usr/src/linux-headers-3.2.0-3-common/include/net/caif
96K /usr/src/linux-headers-3.2.0-3-common/include/scsi/fc
108K /usr/src/linux-headers-3.2.0-3-common/include/net/bluetooth
112K /usr/src/linux-headers-3.2.0-3-common/include/drm/ttm
148K /usr/src/linux-headers-3.2.0-3-common/include/net/netfilter
264K /usr/src/linux-headers-3.2.0-3-common/include/rdma
284K /usr/src/linux-headers-3.2.0-3-common/include/acpi
596K /usr/src/linux-headers-3.2.0-3-common/include/drm
608K /usr/src/linux-headers-3.2.0-3-common/include/scsi
668K /usr/games
6.3M /usr/lib32/gconv
8.9M /usr/lib32
来自man sort
:
-h, --human-numeric-sort
compare human readable numbers (e.g., 2K 1G)
它仍然显示您不在乎的内容,但是现在很容易找到您要做的内容。