Cp

From LQWiki
Jump to navigation Jump to search

cp is the Unix command to copy files and directories. For syntax and options see the man page.

Examples

 cp file1.htm file2.html 
Copies the file1.htm to file2.htm

For verbose mode just add '-v' flag to 'cp' command

 cp -v file1.pdf file2.pdf

Here's an example to backup the file before you edit the original one

 cp -v fstab{,.orig}

you will get an additional file named fstab.orig

Provided by

Most (all?) Linux distributions incorporate this from the GNU Coreutils: man page

Related Commands

  • mv - Moves files
  • rm - Removes files
  • mkdir - Creates a directory
  • dd - device-to-device copier
  • install - Copy and set permissions
  • shred - Remove files securely