The title says, it all, I have a command like:
cp -r /home/usr/dir1 /home/usr/dir2
The title says, it all, I have a command like:
cp -r /home/usr/dir1 /home/usr/dir2
One can pass the -r optop to the cp command to copy directories recursively. It means copy all files and sub directories from /home/usr/dir1/ to /home/usr/dir2/
cp -r /home/vivek/data /home/vivek/backups
OR pass the -a which copies recursively and preservers file permissions, links and more:
cp -a /home/vivek/data /home/vivek/backups
See
https://www.cyberciti.biz/faq/cp-copy-command-in-unix-examples/