The cp command is used to copy a source file to a target file, or a source file to a target directory.
cp source.txt target.txtThis copies the source file source.txt to the target file target.txt
cp source.txt /path/to/directory/This copies the source file source.txt to the target directory, keeping the same filename
Common useful flags include:
-ror-R: Recursively copy directories-i: Interactive mode (prompts before overwriting)-v: Verbose mode (shows what’s being copied)-p: Preserve permissions, ownership, and timestamps