WordPress Code Snippets

A fresh mix of code snippets and tutorials

Download large files via SSH

109

Here is one way to download huge files (or any size file) from your server to your local machine. All you need is an SSH connection and the scp command.

First, before connecting to your server, use Terminal (or client of your choice) to navigate to the directory on your local machine to which you would like to download some large file, for example:

user$ cd ~/Documents

On a Mac, this takes me to the “Documents” directory, which is where I want to put the downloaded file. So now, let’s say I want to download a super-huge log file (> 500MB), which will time-out and crash Plesk if you try to download via browser.

So instead of causing grief, use SSH to download the file direct to your Documents directory. This is easily accomplished using the scp command:

scp root@123.456.789.000:/var/www/vhosts/example.com/statistics/logs/error_log .

Replace “example.com” with your own domain name, and/or edit the path with the name and location of whichever file you would like to download to your local machine. You will also need to edit the “root@123.456.789.000:” to match your own username and IP address. Lastly, the dot “.” simply means to download the file into the current directory (i.e., Documents).


Show Support

Like our new Facebook Page to show support!