概要
ZIP内のファイルをサイズ順に表示するコマンド
(Display files in ZIP in order of size)
コマンド
zipinfoコマンドでzipファイル内の一覧を表示し、sortでサイズ順に並び替える。
(Use the zipinfo command to display the list in the zip file, and use sort to sort by size.)
$ zipinfo hoge.zip |sort -k4hr
Zip file size: 391737353 bytes, number of entries: 756
-rw-rw-r-- 3.0 unx 226074624 bx defN 22-Jul-22 10:18 aaa/bbb/ccc.db
-rw-rw-r-- 3.0 unx 208771833 tx defN 22-Jul-25 07:18 aaa/bbb/ddd.txt
-rw-rw-r-- 3.0 unx 103399424 bx defN 22-Jul-22 10:18 abc/def/ghi.db
...
sortコマンドオプション
sortコマンドで使用しているオプションの詳細
-k<num> | 場所と並べ替え種別を指定する(「-k 2」なら2列目、「-k 2n」なら2列目を数値として並べ替える。複数指定する場合は「-k」オプションを複数回指定する) |
-r | 並び順を降順にする |
-h | サイズをKやMなど単位を考慮してソート |