[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Find obsolete packages without using aptitude?



Hi,

Bob Proulx wrote on 01/14/2015 06:25:
> Fredrik Jonson wrote:
>> Here's a small challenge. I'm trying to find obsolete or orphaned packages
>> on a system that's been dist-upgraded.
>> ...
>> How would you accomplish that assuming you cannot use aptitude?
> 
> Try this:
> 
>   apt-show-versions | grep -v uptodate
> 
<snip>

this doesn't show all the results "aptitude serach ~o" finds on my system (e.g.,
the package xlockmore). What the aptitude command does, I think, is comparing
the list of installed packages (as listed in the file /var/lib/dpkg/status)
against the list of known available packages (as listed in the files
/var/lib/apt/lists/*_Packages).
This shell command works for me:

awk '/^Package: / {print $2}' /var/lib/dpkg/status | sort |
    (awk '/^Package: / {print $2}' /var/lib/apt/lists/*_Packages | sort |
     comm -23 --nocheck-order /dev/fd/3 -) 3<&0

The "comm" command finds the packages only listed in the installed package list.

Regards,
jvp.



Reply to: