Installed Programs Viewing
andrew clarke
mail at ozzmosis.com
Wed May 20 20:56:37 UTC 2015
On Wed 2015-05-20 18:46:56 UTC+0100, Colin Law (clanlaw at gmail.com) wrote:
> On 20 May 2015 at 18:23, andrew clarke <mail at ozzmosis.com> wrote:
> > On Wed 2015-05-20 00:10:06 UTC+0000, agents4jesus at gmail.com (agents4jesus at gmail.com) wrote:
> >
> >> What’s the bash command to view installed programs?
> >>
> >>
> >> I’m basically running out of HD space and am looking for programs to
> >> throw out.
> >
> > This will list the disk usage of each package in KB, with the larger
> > packages at the end:
> >
> > dpkg-query -W -f='${Installed-Size}\t${Package} ${Version}\n' | sort -n
>
> That appears to show some packages that are not installed, for example I see
> 153704 linux-image-extra-3.18.0-13-generic 3.18.0-13.14
> 153841 linux-image-extra-3.16.0-23-generic 3.16.0-23.31
> 153841 linux-image-extra-3.16.0-24-generic 3.16.0-24.32
> 153853 linux-image-extra-3.16.0-25-generic 3.16.0-25.33
> but according to synaptic those are not installed.
dpkg-query still shows the fully installed size of a package even if
it's in an "rc" state.
Technically they are still "installed". They will show up as "rc" if
you run "dpkg -l". "rc" in this case means the package was previously
installed and has been since removed (with apt-get remove), but its
config files remain. (Why linux-image-extra has config files, I'm not
sure. Presumably there's an obscure command to list them.)
To fully uninstall a package along with its config files you can use
"apt-get purge".
Alternatively, we can exclude "rc" packages from the list, only
listing "ii" packages, where "ii" effectively means "fully installed":
dpkg -l | grep ^ii | cut -d ' ' -f 3 | \
xargs dpkg-query -W -f='${Installed-Size}\t${Package} ${Version}\n' | sort -n
Curiously it seems dpkg-query has no way to display the "rc" string
using the -f flag (I consider this a bug), so we had to get creative.
Regards
Andrew
More information about the ubuntu-users
mailing list