Difficulty: Easy
Correct Answer: cpio
Explanation:
Introduction / Context:
While cp copies files, tools like cpio and tar are designed for archiving and moving entire directory hierarchies with metadata preserved. Understanding when to use cpio helps with backups, migrations, and packaging tasks.
Given Data / Assumptions:
Concept / Approach:
cpio reads file lists from standard input and writes archives to standard output or devices, and can also extract. Common patterns: find . -print | cpio -ov > backup.cpio and extraction with cpio -idv < backup.cpio. It is widely used for initramfs images and system backups.
Step-by-Step Solution:
Verification / Alternative check:
List contents with cpio -itv < dir.cpio. Compare trees using diff -r or checksums after extraction.
Why Other Options Are Wrong:
Common Pitfalls:
Final Answer:
cpio.
Discussion & Comments