Bird
0
0

What is the output of the command echo ~/Documents if the user's home directory is /home/alice?

medium📝 Command Output Q13 of 15
Linux CLI - Navigating the File System
What is the output of the command echo ~/Documents if the user's home directory is /home/alice?
A/home/alice/Documents
B/Documents
C~/Documents
D/root/Documents
Step-by-Step Solution
Solution:
  1. Step 1: Understand how shell expands ~

    The shell replaces ~ with the full path of the user's home directory, here /home/alice.
  2. Step 2: Combine with the rest of the path

    Appending /Documents to /home/alice gives /home/alice/Documents.
  3. Final Answer:

    /home/alice/Documents -> Option A
  4. Quick Check:

    echo ~/Documents = /home/alice/Documents [OK]
Quick Trick: Shell expands ~ to full home path before command runs [OK]
Common Mistakes:
MISTAKES
  • Thinking ~ stays as literal tilde
  • Confusing root's home /root with user's home
  • Ignoring path concatenation after ~

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes