Courseiva
Shells, Scripting and Data ManagementeasyMultiple ChoiceObjective-mapped

LPIC-1 Shells, Scripting and Data Management Practice Question

A system administrator wants to display all lines in /var/log/syslog that do NOT contain the string 'error'. Which command accomplishes this?

⚠ Common exam trap

Many candidates confuse `-v` (invert match) with `-i` (case-insensitive) or `-r` (recursive), leading them to select options that still show matching lines instead of excluding them.

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

grep -v 'error' /var/log/syslog

The `grep -v` option inverts the match, displaying only lines that do NOT contain the pattern. Therefore, `grep -v 'error' /var/log/syslog` outputs all lines from the file that lack the string 'error', which directly fulfills the requirement.

Answer analysis

Option-by-option breakdown

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

  • grep -v 'error' /var/log/syslog

    Why this is correct

    Inverts match, showing only lines without 'error'.

  • grep -r 'error' /var/log/syslog

    Why it's wrong here

    Recursively searches directories, but /var/log/syslog is a file; also does not invert match.

  • grep -l 'error' /var/log/syslog

    Why it's wrong here

    Lists only filenames with matching lines, not the lines themselves.

  • grep -i 'error' /var/log/syslog

    Why it's wrong here

    Ignores case but still shows lines containing 'error'.

About these practice questions

One of 527 original LPIC-1 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. 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.