Unofficial practice
Find Which Package Owns a File
A binary or file needs an owner. Ask the package database first so you know whether the file is managed, missing, or from the wrong package family.
Linux One Liners is an independent study and practice resource. It is not affiliated with, endorsed by, or approved by LPI, The Linux Foundation, CompTIA, or any certification provider. This site does not provide exam dumps or real exam questions.
Try first
dpkg -S /usr/bin/ssh
Troubleshooting ladder
- Name the symptom.
- Inspect read-only state.
- Find the owner, service, file, device, mount, or route.
- Read the decisive output field.
- Choose the next narrow command.
- Avoid broad or destructive changes.
- Make the smallest justified change if required.
- Verify and record what changed.
drill evidence
Sample output and answer key
Command anatomy
dpkg -S /usr/bin/ssh
dpkg -S / rpm -qf- find the package that owns a file
path- the installed file being checked
package- the owning package returned by the database
Annotated output
openssh-client: /usr/bin/ssh
What to notice
- package
- the package database owner
- path
- the installed file being queried
Safe vs unsafe move
Common wrong move
Assuming a command was installed manually when the package database knows its owner.
Next safe command
dpkg -s openssh-client | sed -n '1,12p'
Goal
Prove the condition with command output before changing the system.
Safe first command
dpkg -S /usr/bin/ssh
Correct interpretation
The decisive fields are `package`, `path`. The affected object is the path, user, address, or package named by the command output. The next safe command is `dpkg -s openssh-client | sed -n '1,12p'` because it narrows the evidence without jumping to a broad fix. Watch out for this wrong move: Assuming a command was installed manually when the package database knows its owner.
Next safe command
dpkg -s openssh-client | sed -n '1,12p'
Common wrong move
Assuming a command was installed manually when the package database knows its owner.
Self-check
Which package owns the file, and what package-detail command would you run next?
source and objective
Related cert objective
Source status: LPI LPIC-1 overview verified July 3, 2026. Current version 5.0; exams 101-500 and 102-500.
Related command pages
Why this matters
The point is not to memorize a flag. It is to read the evidence, name the next safe check, and avoid the tempting broad fix.