What command is used to copy a file? A. tar B. cpio C. cp D. copy E. None of the above

tar
cpio
cp
copy E. None of the above

The correct answer is C. cp.

cp is a command-line utility for copying files and directories. It is available on most Unix-like operating systems, including Linux, macOS, and FreeBSD.

The syntax for cp is as follows:

cp [options] source destination

The source is the file or directory that you want to copy. The destination is the file or directory that you want to copy the source to.

If you do not specify a destination, cp will copy the source to the current directory.

Some of the most common options for cp are:

-r: Recursively copy directories and their contents.
-a: Preserve the original file permissions and timestamps.
-v: Verbosely print the names of the files being copied.

For example, to copy the file foo.txt to the directory bar, you would use the following command:

cp foo.txt bar

To copy the directory baz and all of its contents to the directory qux, you would use the following command:

cp -r baz qux

To copy the file foo.txt to the directory bar and preserve the original file permissions and timestamps, you would use the following command:

cp -a foo.txt bar

To copy the file foo.txt to the directory bar and print the names of the files being copied, you would use the following command:

cp -v foo.txt bar

For more information on the cp command, please see the man page for cp.