After connecting through your hosting's SSH, access the directory where the file you want to copy is by using the cd command. To learn more about basic SSH commands read this article.
To copy the file or folder, just use the cp command.
To copy a file and change the name and stay inside the same folder use:
cp filename.php newfilename.php
To copy a file to be in another directory use:
cp filename.php destination_directory/
To copy a whole folder and change the name use:
cp -R foldername/ newfoldername/
To copy files to another directory and replace existing files, use:
cp -f filename.php destination_directory/
That’s it! Now you know how to copy files and folders using SSH 😊
- You can read our other tutorials on SSH here.