Updated: 26 March 2024
cp – copy files and directories.
Copy the entire contents of a directory. Using a dot at the end of the source directory indicates that everything within the directory should be copied, including hidden files
cp -a /tmp/wordpress/. /var/www/wordpress
Copy and rename a file
cp program3.cpp homework6.cpp
Copy file into a folder
cp chris-taylor-cv.pdf marketing/
cp image.jpg folder/sameImageNewName.jpg
Preserve the file modify
time, when copying
cp --preserve=timestamps ~/.tmux.conf ~/my-dot-files/