Copy a file

cp is a Linux shell command to copy files and directories.

You can use the “cp” command to copy a file. For example, the following command copies the file “file.txt” to the file “copy_file.txt”:

cp file.txt copy_file.txt

You can use the “cp” command to copy a directories.

Copy from source to dest
$ cp [optionssource dest

cp command main options:

optiondescription
cp -aarchive files
cp -fforce copy by removing the destination file if needed
cp -iinteractive – ask before overwrite
cp -llink files instead of copy
cp -Lfollow symbolic links
cp -nno file overwrite
cp -Rrecursive copy (including hidden files)
cp -uupdate – copy when source is newer than dest
cp -vverbose – print informative messages