The cp
command in Bash is used to repeat recordsdata and directories from one location to a different.
Copy Command Syntax and Clarification
The fundamental syntax of the cp
command is:
cp [OPTION]... SOURCE... DESTINATION
- SOURCE: The file or listing you wish to copy.
- DESTINATION: The situation the place you wish to place the copied file or listing.
- OPTION: Non-obligatory flags that modify the conduct of the
cp
command.
Generally used choices embrace:
-r
or-R
: Recursively copy directories and their contents.-i
: Immediate earlier than overwriting an present file.-u
: Copy solely when the SOURCE file is newer than the DESTINATION file or when the DESTINATION file is lacking.-v
: Verbose mode, which exhibits the recordsdata being copied.-T
: Deal with the vacation spot as a standard file. That is helpful whenever you don’t wish to create a brand new listing on the vacation spot.-f
: Power the copy operation by eradicating the vacation spot file if it can’t be opened.