nerdexam
LPI

102-500 · Question #11

Which of the following commands displays all environment and shell variables?

The correct answer is D. env. env (option D) is correct because it is a standard Unix/Linux command that prints all environment variables currently set in the shell session, making it the go-to tool for inspecting the environment. Why the distractors are wrong: A. getargs - not a real Unix command; getarg…

Shells and Shell Scripting

Question

Which of the following commands displays all environment and shell variables?

Options

  • Agetargs
  • Blsenv
  • Cls
  • Denv
  • Elsshell

How the community answered

(21 responses)
  • B
    14% (3)
  • C
    5% (1)
  • D
    76% (16)
  • E
    5% (1)

Explanation

env (option D) is correct because it is a standard Unix/Linux command that prints all environment variables currently set in the shell session, making it the go-to tool for inspecting the environment.

Why the distractors are wrong:

  • A. getargs - not a real Unix command; getarg is niche and retrieves specific arguments, not variables
  • B. lsenv - does not exist as a standard command
  • C. ls - lists directory contents, not variables
  • E. lsshell - not a real command; confuses the "list shell" concept with actual tooling

Memory tip: Think of env as short for "environment" - it displays the environment. If you need to set or run something with a modified environment, env does that too, but bare env with no arguments dumps everything. Pair it with set (which also shows shell variables and functions) to cover the full picture on exams that ask about "shell variables" specifically.

Topics

#environment variables#env command#shell variables#Linux commands

Community Discussion

No community discussion yet for this question.

Full 102-500 Practice