Courseiva

XK0-006 Automation, Orchestration, and Scripting Practice Question

A Linux administrator needs to parse a structured configuration file and extract the value of a specific key. The file format is JSON, and the administrator wants to use a command-line tool that is commonly preinstalled on modern Linux distributions. Which command should the administrator use?

⚠ Common exam trap

The trap here is assuming that general-purpose text tools like sed, awk, or grep can reliably parse JSON, when their line-oriented nature breaks on nested or formatted JSON.

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

✓

jq

jq is purpose-built for JSON, understands the format's structure, and is commonly available on modern Linux distributions. It can extract a specific key with a simple filter and correctly handles nested data, escaping, and type conversions, making it the appropriate choice for parsing a JSON configuration file.

Answer analysis

Option-by-option breakdown

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

  • ✓

    jq

    Why this is correct

    jq is a lightweight command-line JSON processor that is widely available in distribution repositories and is often preinstalled on modern systems. It can parse JSON, filter with expressions such as .key, and output the value, which directly satisfies the requirement to extract a specific key from a structured JSON file.

  • ✗

    awk

    Why it's wrong here

    awk is a field-oriented text processing language that excels at columnar data such as /etc/passwd or CSV. It has no built-in JSON parser, so extracting a key from JSON would require brittle pattern matching that fails on nested objects, arrays, or whitespace variations. It is not the appropriate tool for this structured format.

  • ✗

    grep

    Why it's wrong here

    grep searches for lines matching a pattern and prints them, but it does not understand JSON syntax or key-value relationships. Using grep to extract a JSON value can match the wrong occurrence, such as a key name appearing in a string, and cannot reliably handle nesting or escaped characters. It is unsuitable for structured JSON parsing.

  • ✗

    sed

    Why it's wrong here

    sed is a stream editor designed for line-oriented text manipulation using regular expressions. While it can sometimes extract text from JSON with fragile patterns, it does not understand JSON structure, so nested objects, escaped characters, and formatting changes can easily break the extraction. It is not a reliable tool for structured JSON parsing.

About these practice questions

This XK0-006 question is part of Courseiva's 781-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 and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed September 2026 · checked against the official CompTIA exam blueprint

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.