[PLUG] ls listing with apt package column [solved and extended]

Bill Barry bill at billbarry.org
Sat Dec 11 06:36:20 UTC 2010


On Fri, Dec 10, 2010 at 2:23 PM, chris (fool) mccraw <gently at gmail.com>wrote:

> On Fri, Dec 10, 2010 at 11:16, Bill Barry <bill at billbarry.org> wrote:
> > The one thing they are not
> > doing is looking at /etc/alternatives. For instance the package
> > xtightvncviewer created the following softlinks
> > /usr/bin/vncviewer -> /etc/alternatives/vncviewer
> > and
> > /etc/alternatives/vncviewer -> /usr/bin/xtightvncviewer
> >
> > The package origin of these soft links are not reported, but it might be
> > possible to add that ability to the find-cruft script.
>
> so, run either one of those options and retain the list of files that
> are not owned by any package.  before cleaning them up, see if they
> are symlinks into /etc/alternatives (which, one supposes, you have not
> mucked around in--only packages you've installed would have done so,
> unless you ran update-alternatives manually or something).  if so,
> assume good.  if no, examine further and/or delete.  it's not
> perfectly programmatic, but i'd probably do something like:
>
>                 cat list_of_unowned_files | xargs ls -l | grep -v
> /etc/alternatives
>
> which would put you where you asked to be =)
>
>
Well, I haven't manually changed /etc/alternatives so this will work.
Here is the combination of Paul's suggestion with yours that finds the files
with no package association and that don't link to /etc/alternatives.

dpkg-query -S /usr/bin/* 2>&1 1> /dev/null  | xargs ls -l | grep -v
"/etc/alternatives"

But it would be nice to have more. Why can't every file in the filesystem
have an attribute or two that says where they originated. Such as what
application created them or which package they are associated with. That way
even if some package got uninstalled and left some junk around, you could
look at the files attributes and find the culprit.  You could use something
like inotify and set an attribute on the file at the time it is created or
modified to show which application last touched it.
But from a quick glance it seems inotify doesn't receive that information or
am I mistaken? Does anybody know of a way to approach this?

Thanks everyone for their help.

Bill



More information about the PLUG mailing list