wyatt8740

[bash/sh] sort installed packages by human-readable sizes

Mar 27th, 2015
430
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.59 KB | None | 0 0
  1. #! /bin/sh
  2. #When using apt/dpkg, to sort all installed packages, largest first, with human-readable file sizes, on a system with a relatively recent (2013) version of GNU Coreutils, do this:
  3. dpkg-query -Wf '${Installed-size}\t${Package}\n' | column -t|numfmt --header --field=1 --to=iec|sort -h --reverse|less
  4.  
  5. #or if you want largest last, do that without '--reverse'.
  6. #dpkg-query -Wf '${Installed-size}\t${Package}\n' | column -t|numfmt --header --field=1 --to=iec|sort -h|less
  7.  
  8. #note that this is incomplete. it displays kilobytes instead of megabytes, and megabytes instead of gigabytes, and so on.
Advertisement
Add Comment
Please, Sign In to add comment