Bird
0
0

You want to combine the contents of chapter1.txt and chapter2.txt into a new file book.txt. Which command correctly does this using cat?

hard📝 Application Q15 of 15
Linux CLI - Viewing and Editing Files
You want to combine the contents of chapter1.txt and chapter2.txt into a new file book.txt. Which command correctly does this using cat?
Acat chapter1.txt chapter2.txt > book.txt
Bcat > chapter1.txt chapter2.txt > book.txt
Ccat chapter1.txt > chapter2.txt > book.txt
Dcat book.txt > chapter1.txt chapter2.txt
Step-by-Step Solution
Solution:
  1. Step 1: Understand output redirection with cat

    The command cat file1 file2 > newfile concatenates file1 and file2 contents and writes to newfile.
  2. Step 2: Analyze each option

    cat chapter1.txt chapter2.txt > book.txt correctly concatenates chapter1.txt and chapter2.txt into book.txt. Options A, C, and D misuse redirection or file order, causing errors or overwrites.
  3. Final Answer:

    cat chapter1.txt chapter2.txt > book.txt -> Option A
  4. Quick Check:

    Use cat file1 file2 > newfile to combine files [OK]
Quick Trick: Use > after files to save combined output [OK]
Common Mistakes:
  • Misplacing > causing overwrite
  • Using > multiple times incorrectly
  • Confusing input and output files

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes