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 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.

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

The above can be rewritten in short form as below

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

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.

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

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 :