On 11/9/24 5:08 AM, Patrick O'Callaghan wrote:
On Fri, 2024-11-08 at 21:53 -0800, Samuel Sieb wrote:
On 11/8/24 8:46 PM, home user via users wrote:
I thought that in the case of a file that IS owned by a package, rpm -qf
was displaying the name of the owned file. So I was expecting a file
name to appear once, not 2000+ times!
It's now occurring to me that in the case of a file that is owned by a
package, it's listing the name of the owning package, not the name of
the owned file. Am I correct?
That is correct.
And now I see why you're confused. It doesn't show the filename, only
the package name, so you'll see an endless list of the package name,
with possibly only a few filenames mixed in.
The OP probably wants to see files that don't belong to an installed
package, so an additional filter would be appropriate, e.g.
...|grep "not owned by any package"
poc
Actually, the op (me!) had already figured that out and posted it in a post yesterday. I'm now believing all I really needed was to pipe through a count-only negative filter:
find [dir] -type f -print0 | xargs -0 rpm -qf | grep -cv " not owned "
A result > zero would indicate something in [dir] is owned by some package, so doing rm -rf [dir] is at best risky.
A result of zero would indicate nothing in [dir] is owned by any package, so using rm -rf [dir] should be safe.
grep's -c and -v options are 2 more things I used to know and had forgotten. They can be quite useful.
--
_______________________________________________
users mailing list -- users@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to users-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/users@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam, report it: https://pagure.io/fedora-infrastructure/new_issue