What are common cp options?

QuestionsQuestions8 SkillsProBasic Files OperationsNov, 16 2025
0113

Common options for the cp command include:

  • -r or --recursive: Copy directories recursively.
  • -i or --interactive: Prompt before overwriting files.
  • -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: Explain what is being done (show the files being copied).
  • -a or --archive: Copy files and directories recursively and preserve attributes (like timestamps and permissions).

For example, to copy a directory and its contents while preserving attributes, you would use:

cp -a source_directory/ destination_directory/

0 Comments

no data
Be the first to share your comment!