Difficulty: Easy
Correct Answer: neither standard input nor standard output file
Explanation:
Introduction / Context:
Understanding how core utilities interact with Unix streams clarifies when to use redirection and when to let tools operate directly on files. While many commands read from stdin and write to stdout by default, some file utilities open source and destination paths themselves without involving the shell's standard streams.
Given Data / Assumptions:
Concept / Approach:
cp opens the source path directly for reading and the destination path for writing using system calls (e.g., open/read/write). It does not read from standard input nor write to standard output during routine copying; instead, it operates on file descriptors associated with the named files. This differs from tools like cat or sed, which naturally connect to stdin/stdout in pipelines.
Step-by-Step Solution:
Verification / Alternative check:
Strace or audit cp: you will see open() on SRC and DEST rather than reads on file descriptor 0 (stdin) or writes on descriptor 1 (stdout). This confirms stream independence for standard usage.
Why Other Options Are Wrong:
Common Pitfalls:
Final Answer:
neither standard input nor standard output file.
Discussion & Comments