35 lines
988 B
Bash
35 lines
988 B
Bash
|
#!/bin/sh
|
||
|
# lists installed Debian packages, sorting by package size
|
||
|
|
||
|
# This could just be a perl script extracting the install package info.
|
||
|
# but I made it a sh script to allow for sort manipulation afterwards.
|
||
|
|
||
|
# Installed packages read from /var/lib/dpkg/status
|
||
|
|
||
|
# found on: http://www.linuxquestions.org/questions/linux-software-2/do-i-need-usr-lib-debug-783100/#post3831610
|
||
|
|
||
|
echo '
|
||
|
open(FILE,"/var/lib/dpkg/status");
|
||
|
$_=<FILE>;
|
||
|
while ($_)
|
||
|
{
|
||
|
if ( /Package:/ )
|
||
|
{
|
||
|
@package = split(" ",$_);
|
||
|
$_=<FILE>;
|
||
|
if ( /install ok installed/ )
|
||
|
{
|
||
|
do
|
||
|
{
|
||
|
$_=<FILE>;
|
||
|
}
|
||
|
until ( /Size:/ );
|
||
|
@size = split(" ",$_);
|
||
|
|
||
|
print( "$package[1] $size[1]\n");
|
||
|
}
|
||
|
}
|
||
|
$_=<FILE>;
|
||
|
}
|
||
|
' | perl | sort -nr -k2
|