On Sat, Oct 31, 2015 at 10:29 AM, Stephen Powell <zlinux...@wowway.com> wrote:
>
> Does anyone know an easy way to identify obsolete packages without
> using aptitide?
>

Here is one way.

To identify packages that are no longer present in the archive
    % apt-show-versions -r . | grep "No available version in archive"
| cut -f 1 -d ':' | sort | uniq > ~/x/cruft.txt

To identify packages that are no longer present in the archive and
contain the word lib in their names
    % apt-show-versions -r lib | grep "No available version in
archive" | cut -f 1 -d ':' | sort | uniq > ~/x/cruft.txt

You need to sort uniq the output since there could be entries such as
    libavcodec55:amd64 6:10.2-1 installed: No available version in archive
    libavcodec55:i386 6:10.2-1 installed: No available version in archive

To remove the packages one by one
    % xargs -n1 -t -a ~/x/cruft.txt -i sudo apt-get remove --purge {}

You need to run these two commands (apt-show-versions and xargs) separately
since apt-get runs interactively and cannot get the input if run from xargs.

hope that helps
raju
-- 
Kamaraju S Kusumanchi | http://raju.shoutwiki.com/wiki/Blog

Reply via email to