SUMMARY: If you zip the folder containing your WordPress files, and download the zip file instead of the folder, the download time will be reduced from several hours to 10 minutes (vs. using FTP to download the WP files). 👾 You can use either cPanel file manager or SSH
This guide doesn’t cover backing up your WordPress database.
When I read about how to backup WordPress site files, the only answer I got was to use a plugin or FTP. FTP is not ideal because certain files can fail to transfer, and it can feel like we need to restart the whole process. These methods can be cumbersome, and there is another way. It’s possible to zip our WordPress site files using a file manager like the one offered in cPanel, or by SSH’ing into our server, and zipping the file through a terminal window. We will look at both methods here.
Zipping your WordPress files through the cPanel File Manager
To zip your WP files through cPanel, first access your file manager and navigate to the parent folder of your WP files. We want to right click on the parent folder, and then click “Compress”. We should chose in the menu that pops up the “Compression Type” of “Zip Archive”, and We can give our zip file a special name (see both images below):
Once we click “Compress” the zip will be created and placed in the same folder as the parent folder that we are zipping. We can then right click this .zip file and download it. The download speed will vary depending on the size of your site, your internet speed, and probably your server hosting plan. But this method will in any case be much faster than FTP!
Zipping your WordPress files using SSH
If we’re using cPanel, we should make sure that SSH access is enabled, or otherwise enable SSH access for our cPanel server. We can then SSH into our cPanel server, and navigate to the folder containing the parent folder of our WordPress files (see image). SSH into cPanel can be done using the syntax:
ssh -p [port number] [username]@[ip address of server]
SSH’ing into our server:
zip in SSH
We need to have the program “zip” installed on our server to perform the zip using SSH. We can check if zip is installed by typing the command
zip and pressing enter:
If zip is not installed, there will be some kind of error message, and probably instructions on the command to install zip. For me it was something like
sudo apt-get install zip
At this point, we can run the command:
zip [give a zip file name].zip [name of folder we want to zip] -r
We want to add that
-r flag at the end. This “r” stands for “recursive”, which means that the zip will recursively zip all of the contents of the folder. We need to use the
-r flag because we’re zipping an entire folder including it’s contents, not just a file. There should be a fast spread of messages preceded be something like “adding:”, which show all of your files getting added to the .zip file. At the end of the process there was no success message for me: I was just placed back at the command line of the terminal (see images):
Downloading .zip file from server with SSH and
scp, or with FTP
It’s possible to download the zip file to your computer using SSH, which we will discuss below. However, if this causes problems, or if you want a possibly easier way, at this point you can log in to the server with FTP to download the zip file (it’s just not possible to actually zip a file via FTP, I believe).
Now, to download the file from the server to our local machine, we need to open a new terminal window to get back to the command line for our local machine (or use the command
exit on our current window, to get back to the command line for our local machine). We will use the command
scp (“secure copy”) to make a copy of the file from our remote server to our local machine. The syntax for the command is like so:
scp -P [port number (if any)] [username]@[server address or IP]:[pathname to zip file on remote server] [pathname to directory where we want to save zip file on local machine]
I believe the default port number used is 22.
See my example in the terminal window below:
If you’re having trouble with the scp command, try entering
scp in your terminal. You should get a display of the syntax and command options (as shown below). You can also check out this helpful StackExchange post on how to use scp on remote and local machines.
Now we can navigate to the folder we designated as the destination for the zip download, and our WP backup should be right there! :
If it worked, great job! 😃 If you’re having trouble, you may want to research the commands (such as zip or scp) or play around with them a bit. Good luck and have fun!