Created
June 5, 2022 21:03
-
-
Save lucascompython/c49d0721bd5d3fb25ee4fe8e557ec294 to your computer and use it in GitHub Desktop.
Shell script (basically just awk) to view a list of the packages that use more space in your disk, PACMAN ONLY.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
pacman -Qi | awk $@ ' | |
BEGIN { | |
units["B"] = 0 | |
units["KiB"] = 1 | |
units["MiB"] = 2 | |
units["GiB"] = 3 | |
if (unit == "") unit = "MiB" | |
if (min == "") min = 50 | |
if (pad == "") pad = 10 | |
} | |
/^Name/ {name=$3} | |
/^Installed Size/ { | |
size = (int($4) * 1024^units[$5]) / 1024^units[unit] | |
if (size > min) printf "% *.1f %s %s\n", pad, size, unit, name | |
} | |
' | sort -n |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment