Copying File and Folders
Description
How to copy files and directories using the command line
Syntax
cp file1.txt file2.txt | Copy a file into another file | |
cp file1.txt destination/ | Copy a file to a folder | |
cp file1.txt file2.txt destination/ | Copy multiple files to a folder | |
cp destination/* . | Copy everything in the destination folder to the current folder | |
cp destination/* .. | Copy everything in the destination folder to the parent folder of the current folder | |
cp -r copy_me/ destination/ | Copy the entire folder 'copy_me' into the destination folder | |
scp file.txt destination/ | Secure copy if copying a file from local to root |
Examples