5 Curl Commands to download Files

Channel: Linux
Abstract: etc. In this tutorial we are providing 5 curl frequently used commands to download files from remote servers. 1. Curl Command to Download File To simp

Curl command file utility supports for downloading and uploading files. Curl is useful for many works with system administration, web development for calling web services, etc. In this tutorial we are providing 5 curl frequently used commands to download files from remote servers.

1. Curl Command to Download File

To simply download a file using curl use following syntax. -O is used for saving file on the local system with the same name on the remote system.

curl -O http://example.com/download/myfile.zip 
2. Curl Download and Save with Other Name

If you want to save file with different name on local system, Use -o with new file name.

curl -o localname.zip http://example.com/download/myfile.zip 
3. Curl to Download Multiple Files

Curl also provides an option to download multiple files simultaneously. To download multiple file use following syntax. All files will be saves with original file names.

curl -O http://example.com/myfile.zip -O http://example.com/myfile2.zip 
4. Use Login Credential with Curl Download

In case files are behind authenticated http or ftp server. You can pass login credentials using -u command line parameter like below examples.

curl -u user:password -O http://example.com/myfile.zip 
curl -u ftpuser:ftppassword -O ftp://ftp.example.com/myfile.zip 
5. Curl Download File via Proxy

If server file is only available through a proxy server, or you want to use a proxy for downloading files, Use -x followed by proxy address and port to download the file via a proxy server.

curl -x "my.proxy.com:3128" -O http://example.net/myfile.zip 
Conclusion

This tutorial 5 examples of curl command for downloading files from remote server.

Ref From: tecadmin
Channels: downloadcurl

Related articles