Source

scripts / pacman_bigpkg.py

#!/usr/bin/env python2

import subprocess
info = subprocess.Popen(['pacman', '-Qi'], stdout = subprocess.PIPE)
res = info.communicate()[0]
pkgs = {}
items = res.split('\n')
for item in items:
    if item.startswith('Name'):
        name = item.split(':')[1].strip()
    elif item.startswith('Installed Size'):
        size = item.split(':')[1].strip().split(' ')[0]
        pkgs[name] = size


names = sorted(pkgs, key=lambda k: float(pkgs[k]))
for i in range(25):
    print names[-i], pkgs[names[-i]]