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…
Question
Options
- Agetargs
- Blsenv
- Cls
- Denv
- Elsshell
How the community answered
(21 responses)- B14% (3)
- C5% (1)
- D76% (16)
- E5% (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;
getargis 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
Community Discussion
No community discussion yet for this question.