Skip to content

Instantly share code, notes, and snippets.

@tmhedberg
Created August 6, 2011 14:05
Show Gist options
  • Select an option

  • Save tmhedberg/1129359 to your computer and use it in GitHub Desktop.

Select an option

Save tmhedberg/1129359 to your computer and use it in GitHub Desktop.
Display the number of cached versions for each package in the pacman cache
#!/bin/bash
ls /var/cache/pacman/pkg |
awk -F - '
{
k = ""
for (i = 1; i < NF - 2; ++i)
k = k $i "-"
sub(/-$/, "", k)
++sum[k]
}
END {
for (k in sum)
print k, sum[k]
}
' |
sort -rk 2 |
column -t |
less
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment