O'Reilly logo

Linux and Unix Shell Programming by David Tansley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

cp

Format:

cp options file1 file2

Options:

-i Prompt for confirmation for overwriting files
-p Preserve the permission modes and modification times
-r Recursively copy a directory

To copy the file myfile to myfile1.bak

					$ cp myfile 1 myfile1.bak
				

To copy the file get.prd from /usr/local/sybin to /usr/local/bin

					$ pwd 
usr/local/sybin 
$ cp get.prd../bin
				

To recursively copy all files and directories from /logs (downwards) to /hold/logs

					$ cp -r /logs/ /hold/logs
				

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required