Cp


From Linuxconfig.org

Jump to: navigation, search

.. back to the list of Linux Commands

Name

cp - copy files and directories

Synopsis - man page

cp [OPTION]... [-T] SOURCE DEST
cp [OPTION]... SOURCE... DIRECTORY
cp [OPTION]... -t DIRECTORY SOURCE...

Frequently used options

-i, --interactive
       prompt before overwrite
-p     same as --preserve=mode,ownership,timestamps
-R, -r, --recursive
       copy directories recursively
-v, --verbose explain what is being done

Examples

Copy directory dir2 and its content into directory dir1:

cp -r dir2/ dir1/
Image:cp01.gif

Copy all files from dir2 to dir1:

cp dir2/* dir1/
Image:cp02.gif

Copy file1 from dir1 to dir2 but prompt before overwrite:

cp -i dir1/file1 dir2/
Image:cp03.gif

Copy file1 from dir1 to dir2 and preserve mode,ownership and timestamps:

cp -p dir1/file1 dir2/
Image:cp04.gif

.. back to the list of Linux Commands

Personal tools
Linux Commands