2020-12-29 08:38:07 -08:00
|
|
|
#!/usr/bin/env sh
|
2021-07-29 00:37:35 -07:00
|
|
|
# YES_ZSH
|
2021-07-29 05:44:12 -07:00
|
|
|
# YES_BASH
|
|
|
|
# YES_DASH
|
2021-07-29 00:37:35 -07:00
|
|
|
|
2021-07-30 17:57:08 -07:00
|
|
|
pacbm() { ### @-
|
2021-08-01 09:27:25 -07:00
|
|
|
### display and order installed pacman packages by their filesize ascending,
|
|
|
|
### and their sum. requires `expac`.
|
2021-07-30 17:57:08 -07:00
|
|
|
###
|
|
|
|
### ```
|
|
|
|
### $ pacbm | head -n -1 | tail -2
|
|
|
|
### 204.78M clang
|
|
|
|
### 235.44M linux-firmware
|
|
|
|
### ```
|
2021-07-29 00:37:35 -07:00
|
|
|
expac -s '%m %n' | awk '
|
|
|
|
{t+=$1;printf("%8.2fM %s\n",$1/(1024*1024),$2)}
|
|
|
|
END{printf("%8.2fM\n",t/(1024*1024))}
|
|
|
|
' | sort -n
|
|
|
|
}
|
|
|
|
|
|
|
|
[ "${SOURCING:-0}" -gt 0 ] || pacbm "$@"
|