cp

From Juneday education
Jump to: navigation, search


cp - copy files and directories..

On this page we only give you a short introduction with a few examples. We encourage you to read the manual (man cp).

Description

cp is a UNIX command for copying files and directories. The command has three principal modes of operation, expressed by the types of arguments presented to the program for copying a file to another file, one or more files to a directory, or for copying entire directories to another directory.
Read about cp on wikipedia

Example usage

To create a copy of the file MyMain.java and call the copy MyMain.backup

$ cp MyMain.java MyMain.backup

To copy the file MyMain.java (located in the current directory) to the directory backup

$ cp MyMain.java backup

To copy all the Java files (located in the current directory) to the directory backup

$ cp *.java backup