Courseiva
hardMultiple ChoiceObjective-mapped

XK0-006 Practice Question: Which command will show the environment variables…

Which command will show the environment variables for a specific process?

⚠ Common exam trap

CompTIA often tests the distinction between commands that show the current shell's environment (`set`, `printenv`, `env`) versus the `/proc` filesystem method that targets a specific process, leading candidates to pick a shell command instead of the process-specific file.

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

cat /proc/$PID/environ

The `/proc/[PID]/environ` file contains the environment variables that were set when the process was started. Reading this file with `cat` displays the exact environment of a specific process, which is not possible with shell built-ins or user-level commands that only show the current shell's environment.

Answer analysis

Option-by-option breakdown

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

  • cat /proc/$PID/environ

    Why this is correct

    Reading /proc/<pid>/environ displays the environment variables of that specific process.

  • set

    Why it's wrong here

    set shows all shell variables and functions, not just environment.

  • printenv

    Why it's wrong here

    printenv also shows current shell environment.

  • env

    Why it's wrong here

    env shows the current shell's environment, not another process.

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.