How to copy a folder to another folder in Linux: 1. Open a terminal command window; 2. Copy the folder packageA to the packageB file through the "cp -r /home/packageA /home/packageB" command Just clip it.
#The operating environment of this tutorial: linux5.9.8 system, Dell G3 computer.
How to copy a folder to another folder in Linux?
Linux Copy a folder or all the contents under a folder to another folder
cp -r /home/packageA/* /home /cp/packageB/
orcp -r /home/packageA/. /home/cp/packageB/
These two methods have the same effect.
Method example:
cp -r /home/packageA /home/packageB
After running the command, there will be thepackageA
folder under thepackageB
folder. .
Method example:
rm -rf /home/packageA
-r
means downward recursion, no matter how many levels of directories there are, delete them all-f
means direct forcible deletion without any prompt
Method example:
mv /home/packageA /home/packageB/
ormv / home/packageA /home/packageB
These two methods have the same effect.
Method example:
mv /home/packageA/* /home/packageB/
Method example:
Recommended study: "Linux Video Tutorial"
The above is the detailed content of How to copy a folder to another folder in linux. For more information, please follow other related articles on the PHP Chinese website!