💾 Archived View for perso.pw › blog › articles › openbsd-packages-size.gmi captured on 2023-05-24 at 18:26:22. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2023-01-29)

➡️ Next capture (2024-03-21)

🚧 View Differences

-=-=-=-=-=-=-

Display the size of installed packages ordered by size

on Mastodon

Simple command line to display your installed packages listed by size

from smallest to biggest.

$ pkg_info -sa | paste - - - - | sort -n -k 5

Thanks to sthen@ for the command, I was previously using one involving

awk which was less readable. **paste** is often forgotten, it has very

specifics uses which can't be mimic easily with other tools, its

purpose is to joins multiples lines into one with some specific rules.

You can easily modify the output to convert the size from bytes to

megabytes with awk:

$ pkg_info -sa | paste - - - - | sort -n -k 5 | awk '{ $NF=$NF/1024/1024 ; print }'

This divides the last element (using space separator) of each line

twice by 1024 and displays the line.