Which command identifies which package provides a given file, with example /bin/ls?

Prepare for the Red Hat Certified Systems Admin Exam EX200. Enhance your skills with interactive quizzes, flashcards, and detailed explanations. Ace your certification exam today!

Multiple Choice

Which command identifies which package provides a given file, with example /bin/ls?

Explanation:
To find which package owns a specific file, use a provides query. Running the command that provides /bin/ls asks the package manager to search its metadata for the package that supplies that exact file. It will typically respond with the package (such as coreutils) that includes the /bin/ls binary. This is the direct and reliable way to map a filesystem file to its owning package. Other commands don’t target file ownership. Listing packages with dnf list /bin/ls shows packages by name or status, not which one contains that file. Searching with dnf search /bin/ls looks through package names and descriptions, not the actual file-provides data. Asking for info on /bin/ls (dnf info /bin/ls) treats the argument as a package name, which won’t resolve the file-to-package relationship. If you know the package name, you can use dnf info on that package, or you can use rpm -qf /bin/ls as an alternative way to find the owning package.

To find which package owns a specific file, use a provides query. Running the command that provides /bin/ls asks the package manager to search its metadata for the package that supplies that exact file. It will typically respond with the package (such as coreutils) that includes the /bin/ls binary. This is the direct and reliable way to map a filesystem file to its owning package.

Other commands don’t target file ownership. Listing packages with dnf list /bin/ls shows packages by name or status, not which one contains that file. Searching with dnf search /bin/ls looks through package names and descriptions, not the actual file-provides data. Asking for info on /bin/ls (dnf info /bin/ls) treats the argument as a package name, which won’t resolve the file-to-package relationship. If you know the package name, you can use dnf info on that package, or you can use rpm -qf /bin/ls as an alternative way to find the owning package.

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy