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 seems to not respect data units represented with lower-case characters...

Full Command Examples

⚠️
Make sure your system has gawk (GNU Awk). The Awk subcommand 'gensub' requires the GNU version.
If you're unsure, check if awk is symlinked to the alternatives and find out where that is going (update-alternatives --query awk).
🤖
To list the size of Flatpak runtimes instead of applications, replace --app with --runtime.
  1. 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 ',' -t
  1. Columns: 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 ',' -t
  1. Columns: 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 '|' -t
  1. Columns: 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 ',' -t
  1. Columns: 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
💬
If you have any questions/comments regarding this article, click here or scroll down below (login isn't required to post comments and there's no waiting period).

Table of Data Unit Standards

Multi-byte Units

Decimal Binary
Value SI Value IEC JEDEC
1000 10³ kB kilobyte 1024 2¹⁰ KiB kibibyte KB kilobyte
1000² 10⁶ MB megabyte 1024² 2²⁰ MiB mebibyte MB megabyte
1000³ 10⁹ GB gigabyte 1024³ 2³⁰ GiB gibibyte GB gigabyte
1000⁴ 10¹² TB terabyte 1024⁴ 2⁴⁰ TiB tebibyte TB terabyte
1000⁵ 10¹⁵ PB petabyte 1024⁵ 2⁵⁰ PiB pebibyte —
1000⁶ 10¹⁸ EB exabyte 1024⁶ 2⁶⁰ EiB exbibyte —
1000⁷ 10²¹ ZB zettabyte 1024⁷ 2⁷⁰ ZiB zebibyte —
1000⁸ 10²⁴ YB yottabyte 1024⁸ 2⁸⁰ YiB yobibyte —
1000⁹ 10²⁷ RB ronnabyte 1024⁹ 2⁹⁰ RiB robibyte —
1000¹⁰ 10³⁰ QB quettabyte 1024¹⁰ 2¹⁰⁰ QiB quebibyte —

Comparison of binary and decimal units and values

Binary Decimal
Name Symbol Value (base 2) Name Symbol Value (base 10)
kibibyte KiB 2¹⁰ kilobyte KB 10³
mebibyte MiB 2²⁰ megabyte MB 10⁶
gibibyte GiB 2³⁰ gigabyte GB 10⁹
tebibyte TiB 2⁴⁰ terabyte TB 10¹²
pebibyte PiB 2⁵⁰ petabyte PB 10¹⁵
exbibyte EiB 2⁶⁰ exabyte EB 10¹⁸

Percentage difference between decimal and binary units

Decimal value Binary equivalent of decimal value Difference
100 kilobytes (KB) 97.65 kibibytes (KiB) 2.35%
100 megabytes (MB) 95.36 mebibytes (MiB) 4.64%
100 gigabytes (GB) 93.13 gibibytes (GiB) 6.87%
100 terabytes (TB) 90.94 tebibytes (TiB) 9.06%
100 petabytes (PB) 88.81 pebibytes (PiB) 11.19%
100 exabytes (EB) 86.73 exbibytes (EiB) 13.27%

Download Sam Harris Making Sense Full Subscriber Podcast Episodes for Free
Use the following script of your choice (Shell/Bash or PowerShell) to download full length subscriber episodes of the Sam Harris Making Sense podcast for free. If you would rather use a simple web interface, Grok made an awesome SPA web app that does what the script does, but in the browser.
Free T-Shirt Swag
I randomly found a link to get a 100% free t-shirt from Fleet and would like to share it. You get a choice of either white or black and the size. They cover the shipping cost and don’t ask for any details other than what they require to ship it to you.