How to: Find the Largest Flatpak Applications Sorted by File Size
If you just want to ensure that your output is truly sorted by the size column, skip to the next section. When you search for this question you will likely see: flatpak list --app --columns=size,name | sort -h -r. If you have any applications under 1 MB then the output will be listed in kB (lower-case k and upper-case B). Apparently Flatpak strictly follows the SI unit standard prefixes designating kilo with lower-case k. The problem is the sort command does not respect data units represented with lower-case characters...
The Mickey Mouse Fix:
🔥 Make sure your system has Gawk (GNU Awk). The Awk subcommand gensub requires the GNU version.
Columns: size,application
flatpak list --app --columns=size,application | awk -F'\t' -v OFS=',' '{ $0 = gensub(/.([GMk])B/, "\\1", "g"); $1 = toupper($1); print }' | sort -k 1rh | column -s ',' -tColumns: size,application,name
flatpak list --app --columns=size,application,name | awk -F'\t' -v OFS=',' '{ $0 = gensub(/.([GMk])B/, "\\1", "g"); $1 = toupper($1); print }' | sort -k 1rh | column -s ',' -tColumns: size,application,name,description
flatpak list --app --columns=size,application,name,description | awk -F'\t' -v OFS='|' '{ $0 = gensub(/.([GMk])B/, "\\1", "g"); $1 = toupper($1); print }' | sort -t '|' -k 1rh | column -s '|' -tColumns: application,name,size
flatpak list --app --columns=application,name,size | awk -F'\t' -v OFS=',' '{ $0 = gensub(/.([GMk])B/, "\\1", "g"); $3 = toupper($3); print }' | sort -t ',' -k 3rh | column -s ',' -tColumns: application,name,description,size
flatpak list --app --columns=application,name,description,size | awk -F'\t' -v OFS='|' '{ $0 = gensub(/.([GMk])B/, "\\1", "g"); $4 = toupper($4); print }' | sort -t '|' -k 4rh | column -s '|' -t
🤖 For listing the sizes of Flatpak runtimes instead of applications, use
--runtimeinstead of--app.
https://blog.travisflix.com/how-to-find-the-largest-flatpak-applications-sorted-by-file-size/