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
Get Linux and Unix Shell Programming now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.