Courseiva
System ManagementmediumMultiple ChoiceObjective-mapped

XK0-006 System Management Practice Question

A technician needs to replace the string 'old_config' with 'new_config' in the file /etc/app.conf and save the changes in place. Which sed command accomplishes this?

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

sed -i 's/old_config/new_config/g' /etc/app.conf

The -i flag edits the file in place, and the s///g substitution replaces all occurrences.

Answer analysis

Option-by-option breakdown

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

  • sed -i 's/old_config/new_config/g' /etc/app.conf

    Why this is correct

    Correct usage of in-place substitution globally.

  • sed 's/old_config/new_config/' /etc/app.conf

    Why it's wrong here

    Without -i, changes are only shown on stdout.

  • sed -n 's/old_config/new_config/p' /etc/app.conf

    Why it's wrong here

    -n suppresses output, p prints only changed lines, but not in-place.

  • sed -i 's/old_config/new_config/' /etc/app.conf

    Why it's wrong here

    Missing g flag replaces only first occurrence per line.

About these practice questions

One of 979 original XK0-006 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 XK0-006 practice question is part of Courseiva's free CompTIA 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 XK0-006 exam.