How to Download Files On Linux Using wget command or curl command




How to Download Files Using wget and curl

If you want to download files on your Linux or Unix system, wget and curl are your main options.

Wget

Wget is a free GNU command line utility for non-interactive download of files from any web location. wget supports HTTPHTTPS, and FTP protocols. In addition wget also supports retrieval through HTTP proxies.

Wget syntex

wget [option]… [URL]…

Wget Example

The following wget command downloads the tar file from the web and stores it with the same name as on the remote server. The downloaded file will be saved on your current working directory.

$ wget http://download.redis.io/releases/redis-4.0.0.tar.gz

The following wget command downloads a file but save it locally under a different name

$ wget ‐‐output-document=filename.tar http://download.redis.io/releases/redis-4.0.0.tar.gz

The above can be rewritten in short form as below

$ wget -O filename.tar http://download.redis.io/releases/redis-4.0.0.tar.gz

CURL

curl is a command line tool to transfer data from or to a remote server using variety of the supported protocols such as HTTPHTTPS , FTP etc.
Curl syntex

curl [option]… [URL]

The following curl command downloads the tar file from the web and stores it with the same name as on the remote server. The downloaded file will be saved on your current working directory.

$ curl -O http://download.redis.io/releases/redis-4.0.0.tar.gz

Please keep in mind Option/flag -O (upper-case O) in the above command is important. Without -O flag curl will start dumping the downloaded file to the stdout.
The following wget command downloads a file but save it locally under a different name

$ curl http://download.redis.io/releases/redis-4.0.0.tar.gz --output filename.tar

Run curl with curl silent

-s, --silent – curl Silent or quiet mode. This means using this flag curl will not show progress meter or error messages.
Example :

$ curl http://download.redis.io/releases/redis-4.0.0.tar.gz --output filename.tar --silent

 


Partner Sites

VideoToGifs.com

EasyOnlineConverter.com

SqliteTutorials.com





Be the first to comment

Leave a Reply

Your email address will not be published.


*