What are common `cp` options?

0229

Here are some common options for the cp command:

Common cp Options:

  • -r or --recursive: Copy directories and their contents recursively.
  • -i or --interactive: Prompt before overwriting an existing file.
  • -u or --update: Copy only when the source file is newer than the destination file or when the destination file is missing.
  • -v or --verbose: Provide detailed output of the copy process, showing files being copied.
  • -a or --archive: Copy files and directories recursively while preserving attributes (like timestamps and permissions).
  • -f or --force: Remove the destination file if it cannot be opened, allowing the copy to proceed.

Example Usage:

cp -rv source_directory destination_directory

This command copies the source_directory and its contents to destination_directory, providing verbose output.

If you have any further questions or need more details, feel free to ask!

0 Comments

no data
Be the first to share your comment!