Copying files and directories is an essential task in Linux.
The cp
command
The cp
command is used to copy files and directories from one location to another.
Basic syntax:
|
|
The SOURCE
can be one or many files / directories, and the DEST
can be a single file or directory.
Copying multiple files to a directory
|
|
Copying matching files to a directory
|
|
Copying a directory to another directory
Using the -r
or -R
or --recursive
option, cp
will recursively copy a directory - including its files and subdirectories.
|
|
Copying files without clobbering
Using the -i
or --interactive
option, cp
will iteratively request user input for files with naming conflicts.
|
|
Include verbosity when copying files
|
|