Courseiva

LPIC-1 Linux Installation and Package Management Practice Question

A Linux administrator is managing a server that uses RPM-based package management. They need to find which installed package provides the '/etc/ssh/sshd_config' file. Which command should they use?

⚠ Common exam trap

It's easy for candidates to confuse the purpose of RPM query options: `-qi` (package info), `-ql` (file list), and `-qf` (file ownership), and often pick `-ql` thinking it lists files, but fail to realize it requires a package name, not a file path.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

rpm -qf /etc/ssh/sshd_config

The correct command is `rpm -qf /etc/ssh/sshd_config`. The `-q` flag queries the RPM database, and `-f` (or `--file`) tells RPM to find which installed package owns the specified file. This is the standard way to map a file back to its originating package in RPM-based systems.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    rpm -qi /etc/ssh/sshd_config

    Why it's wrong here

    Shows package info, but expects a package name.

  • ✓

    rpm -qf /etc/ssh/sshd_config

    Why this is correct

    The -qf flag queries the RPM database for the package owning a specified file path, directly satisfying the need to identify the provider of /etc/ssh/sshd_config. Unlike -ql, which lists files within a named package, -qf works backwards from the file to its owning package.

  • ✗

    rpm -ql /etc/ssh/sshd_config

    Why it's wrong here

    Lists files in a package, not the package for a file.

  • ✗

    rpm -qa | grep sshd_config

    Why it's wrong here

    Piping rpm -qa into grep matches package names containing the string, not the files those packages own, so it returns nothing for sshd_config. It is tempting because grep is familiar for searching command output, but file-to-package mapping requires querying the RPM database's file lists instead.

About these practice questions

Courseiva writes every LPIC-1 question from scratch — 402 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This LPIC-1 practice question is part of Courseiva's free LPI certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the LPIC-1 exam.