How to download a file from a website via terminal?

wittwerch

Member
Registered
Joined
Oct 24, 2016
Messages
28
Points
0
I have a zip file on my hosting server, I want to move it to another VPS on another website, what are the best way to download or moving a file from a website to a VPS via terminal?
 

aussielunix

Member
Registered
Joined
Aug 29, 2016
Messages
38
Points
8
I would recommend Wget, it is a free tool available for Linux that allows us to download files from the web in a very simple way. Currently it has support for downloading files from HTTP, HTTPs and FTP servers.

The features of Wget are:

Robustness: It is very rare for a connection to be lost. Wget provides a stable connection by continuing the download in the event of a connection loss.
Recursive download: Ensures that all files are downloaded as it performs several passes to the links or web.
Portability: Being written in C and being OpenSource can be ported easily to other operating systems.
Allows you to download large files without any limitations.
You can limit the bandwidth to use.

Here's the command you can use to download a file from a website, of course you should know the location of the file store on your host.

Code:
wget http://www.example.com/your_file.zip
In other words, with wget we can also download a website completely for using offline without problems.

Code:
wget -m -F -p -np -k -erobots=off -U mozilla --limit-rate=50K --wait=2 --html-extension http://www.example.com
We must change example.com for the web that we want to download. The -limit-rate parameter allows us to set a speed limit for downloading.

-U allows us to establish with which browser we want it to look like we see the web. We can write anything.
-erobots allows us to establish whether or not we will download the robots from the web.
-F force to download the web despite errors may occur.
-k generates local links to local files for proper offline viewing.

Once the web has been downloaded, press "enter" and wget will start to download it.

Once the download is complete we can verify that the web has been stored in our personal directory under a folder with the same name as the web. We will have the web available for offline viewing perfectly.

Although there are many more tools to download webs, wget is one of the easiest way to use for transferring files from a VPS to another VPS. This tool also allows us to download files with HTTP protocol simply by putting wget url as mentioned above.
 

David Beroff

Well-known member
Registered
Joined
Jun 14, 2016
Messages
1,477
Points
63
Wget seems working best if we want to download file from a site through ssh but some sites could block this command by putting these codes in a htaccess file.

Code:
SetEnvIfNoCase User-Agent "^Wget" bad_bot

<Limit GET POST>
   Order Allow,Deny
   Allow from all
   Deny from env=bad_bot
</Limit>
 

AlbaHost

Well-known member
Moderator
Hosting Provider
Joined
Jan 18, 2017
Messages
775
Points
43
I have a zip file on my hosting server, I want to move it to another VPS on another website, what are the best way to download or moving a file from a website to a VPS via terminal?
If you have a ssh access on both servers, you can use scp to transfer files between your servers.
 

LJSHost

Well-known member
Hosting Provider
Registered
Joined
Jul 5, 2016
Messages
1,031
Points
63
I would use wget also, just put the file somewhere in your public_html and wget it from the other server.
 

racksandcloud

Well-known member
Registered
Joined
May 18, 2017
Messages
89
Points
0
you can move the .zip file to your document root of the website and can download it using the wget command as showing below

==
wget your-domain.com/your-file.zip
==

But we recommend scp or sftp to move the files between the servers. If you have cpanel account, then use sftp or ftp. only use the above method if you do not have any ftp access or ssh access to the source server.
 

secretlytaco

New member
Registered
Joined
Aug 3, 2017
Messages
6
Points
0
Everyone here is recommending wget to download files, so I'll recommend something different.

curl is an alternative to wget with quite a few more options, and is available on a lot more systems. It supports a lot of protocols that wget doesn't, such as SCP, SFTP, LDAP, SMTP, and a few more.

If all you want to use curl for is downloading a single file, you just have to run
Code:
curl -O https://example.com/file.zip
You can also have curl download the file under a different name, with the following (note the lowercase o this time)
Code:
curl -o newName.zip https://example.com/file.zip
 

Latest Hosting OffersNew Reviews

Sponsors

Tag Cloud

You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an alternative browser.

Top