Bird
0
0

You want to save the current directory path to a file named current_dir.txt (overwriting it if it exists). Which command correctly does this?

hard📝 Application Q15 of 15
Linux CLI - Navigating the File System
You want to save the current directory path to a file named current_dir.txt (overwriting it if it exists). Which command correctly does this?
Apwd > current_dir.txt
Bpwd >> current_dir.txt
Cpwd | current_dir.txt
Dpwd current_dir.txt
Step-by-Step Solution
Solution:
  1. Step 1: Understand output redirection

    The symbol > redirects the output of a command to a file, overwriting it.
  2. Step 2: Apply redirection to pwd

    Using pwd > current_dir.txt writes the current directory path into the file current_dir.txt.
  3. Step 3: Check other options

    pwd >> current_dir.txt appends instead of overwriting. Options A and C are invalid syntax.
  4. Final Answer:

    pwd > current_dir.txt -> Option A
  5. Quick Check:

    Use > to save command output to a file [OK]
Quick Trick: Use > to save output; >> appends output [OK]
Common Mistakes:
  • Using pipe (|) incorrectly to file
  • Forgetting > or >> for redirection
  • Using command with filename as argument

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes