mirror of
https://github.com/notwa/rc
synced 2024-11-05 02:39:03 -08:00
24 lines
548 B
Bash
Executable file
24 lines
548 B
Bash
Executable file
#!/usr/bin/env sh
|
|
# YES_ZSH
|
|
# YES_BASH
|
|
# YES_DASH
|
|
# YES_ASH
|
|
|
|
# TODO: does this work with busybox awk?
|
|
|
|
pacbm() { ### @-
|
|
### display and order installed pacman packages by their filesize ascending,
|
|
### and their sum. requires `expac`.
|
|
###
|
|
### ```
|
|
### $ pacbm | head -n -1 | tail -2
|
|
### 204.78M clang
|
|
### 235.44M linux-firmware
|
|
### ```
|
|
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
|
|
}
|
|
|
|
[ -n "${preload+-}" ] || pacbm "$@"
|