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

Re: How can I find packages manually installed using "dpkg -i"?



On Tue 03 Oct 2023 at 19:58:57 (-0700), Mike Castle wrote:
> Some tools I've been using lately are apt-mark and "dpkg-query --show".
> 
> The following UNTESTED commands (ran as a normal user):
> 
> (apt-mark showauto ; apt-mark showmanual) > apt-thinks-you-installed.txt
> dpkg-query --show --showformat='${Package}\n' | grep -v -F -f
> apt-thinks-you-installed.txt > rest.txt

(I've added the omitted -f.)

> The file "rest.txt" should have a list of packages installed that were
> NOT installed via apt.  With any luck, it is small enough to examine
> manually.

I don't think your grep will work correctly. apt-thinks-you-installed.txt
contains patterns, and some of those patterns are very short, for example:
an at bc dc di gv jq mc pv tk acl ant apt bbe cpp ftp git gpg gpm kbd
lz4 mbr mpv mtr pia sed sox tar tcl ucf ufw ure vim w3m xli xxd zip.
These will match packages in the dpkg-query whose names don't actually
appear as complete strings in apt-thinks-you-installed.txt. For example,
pv is in mpv, bbe is in librubberband2. "an" and "at" occur in scores
of package names.

I think you need to enclose each pattern (ie each line of
apt-thinks-you-installed.txt) in the anchors, ^ and $. Ironically,
it would be trivial to add these characters to the output of
dpkg-query, but that's not where they're needed.

Cheers,
David.


Reply to: