How to use the 'wget' SSH command to transfer large files between servers

We typically use the cPanel File Manager to upload files to the server. Most times the speed is good enough, but sometimes the file is really big, or the connection is patchy enough to crawl at 50kbps (anyone?).

Sometimes a simple PHP script can fix the issue (see: How to upload into cPanel from a 3rd party URL).

However, this doesn't always work. Here's where wget comes in – this is for pulling a file straight onto a cPanel-hosted destination server over SSH, bypassing the browser upload entirely.

What you need:

  1. cPanel username and password to the destination server
  2. Shell access for the destination server. Shared hosting usually doesn't provide shell access, check with your host for this. Of course, you could also just ask your host to transfer the file for you... but then you wouldn't need this tutorial now, would you? :P
  3. PuTTY (download here)

1. Login to PuTTY with the cPanel username and password

Open PuTTY and fill in the destination server's URL or IP address, then click Open.

This opens a black terminal screen. Type the cPanel username and hit Enter.

You'll be prompted for the password. Copy it as usual with Ctrl+C, then right-click into the terminal screen and press Enter to paste it in. Ctrl+V doesn't work in PuTTY, for security reasons.

2. Type the wget command

Once you're logged in, type the command below and hit Enter:

wget https://destination-url.com/filename.zip

For example:

wget https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png

That's it! Just sit back and wait, upload speed is usually in the tens of MB/s.

The resulting file lands in whatever directory you were in when you ran the command, which by default is your root folder.

If something goes wrong

A few common snags: if the terminal says wget: command not found, your host hasn't installed wget on that server, ask them to add it, or check whether curl is available instead. A "permission denied" error usually means you're trying to write to a folder your cPanel user doesn't own, cd back to your home directory first and try again. And if the file downloaded fine but you can't find it, remember wget saves to whatever directory you were in when you ran the command, not necessarily public_html. Run pwd to check where you landed, then mv the file if you need it elsewhere.

All posts