Difficulty: Easy
Correct Answer: cd
Explanation:
Introduction / Context:
Navigating directories is a daily task in Unix/Linux. Returning quickly to your home directory saves time. The POSIX standard defines a simple way to do this that works across Bourne-like shells (sh, bash, ksh, dash).
Given Data / Assumptions:
cd
behavior.
Concept / Approach:
Running cd
with no arguments changes the current directory to $HOME
. This is standardized, portable, and works consistently. Alternative shortcuts like cd ~
also work in many shells due to tilde expansion, but the canonical minimal form is bare cd
.
Step-by-Step Solution:
pwd
.Execute cd
with no arguments.Verify new location with pwd
, which should equal $HOME
.Optionally use echo $HOME
to see the target path.
Verification / Alternative check:
Try cd ~
as an alternative in bash/ksh/zsh; it should produce the same result. Using cd -
will toggle back to the previous directory if needed.
Why Other Options Are Wrong:
cd ..
(with space) to go up one level, not to home./
, not the home directory.HOME
is an environment variable and would require expansion like cd "$HOME"
.cd
is correct.
Common Pitfalls:
Confusing root directory with home; forgetting quotes when $HOME
contains spaces; assuming cd..
(DOS style) works on Unix shells.
Final Answer:
cd
mail
program's internal command set, which command forwards the current message to the specified user-list?
Discussion & Comments