Courseiva
GNU and Unix CommandseasyMultiple SelectObjective-mapped

LPIC-1 GNU and Unix Commands Practice Question

Which THREE of the following are correct features of the 'grep' command? (Choose three.)

⚠ Common exam trap

A common mix-up: candidates confuse `-l` (list filenames) with `-n` (show line numbers) and assume `-r` enables regex, when in fact `-r` is for recursive directory traversal and regex is the default behavior.

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

-i makes the search case-insensitive

The `-i` flag in `grep` performs case-insensitive matching, so patterns like 'error' will match 'Error', 'ERROR', etc. This is a common requirement when searching log files where case may vary.

Answer analysis

Option-by-option breakdown

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

  • -i makes the search case-insensitive

    Why this is correct

    Correct: --ignore-case.

  • -v inverts the match

    Why this is correct

    Correct: --invert-match.

  • -c counts matching lines

    Why this is correct

    Correct: --count.

  • -l prints line numbers of matches

    Why it's wrong here

    -l lists filenames with matches, not line numbers.

  • -r enables regular expression matching

    Why it's wrong here

    -r enables recursive directory search; grep uses basic regex by default.

About these practice questions

This LPIC-1 question is part of Courseiva's 527-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam 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.