• Home
  • Ubuntu 18.04
    • Whats New?
    • Upgrade Ubuntu
    • Install Java
    • Install Node.js
    • Install Docker
    • Install Git
    • Install LAMP Stack
  • Tutorials
    • AWS
    • Shell Scripting
    • Docker
    • Git
    • MongoDB
  • Funny Tools
  • FeedBack
  • Submit Article
  • About Us
TecAdmin
Menu
  • Home
  • Ubuntu 18.04
    • Whats New?
    • Upgrade Ubuntu
    • Install Java
    • Install Node.js
    • Install Docker
    • Install Git
    • Install LAMP Stack
  • Tutorials
    • AWS
    • Shell Scripting
    • Docker
    • Git
    • MongoDB
  • Funny Tools
  • FeedBack
  • Submit Article
  • About Us

5 Curl Commands to download Files

Written by Rahul, Updated on April 2, 2019

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 and Save 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. Passing 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 Server

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

Share it!
Share on Facebook
Share on Twitter
Share on LinkedIn
Share on Reddit
Share on Tumblr
Share on Whatsapp
Rahul
Rahul
Connect on Facebook Connect on Twitter

I, Rahul Kumar am the founder and chief editor of TecAdmin.net. I am a Red Hat Certified Engineer (RHCE) and working as an IT professional since 2009..

3 Comments

  1. Avatar Mubbeena Reply
    June 28, 2018 at 7:59 pm

    I don’t know who you are but THANK YOU!!!!!!!!!!!!!!!

  2. Avatar amit Reply
    July 12, 2017 at 8:18 am

    Hi ,
    /usr/bin/curl”,”-k”,”-u”,userName+”:”+password,”\””+hostIP+”\””,”-o” ,csvDownloadPath+”ggggg.csv”

    I am using this command , where i am doing wrong, we are not getting any error in logs, running this command in java ,on linux server.

    • Avatar amit Reply
      July 12, 2017 at 8:23 am

      try{
      ProcessBuilder pb = new ProcessBuilder(“/usr/bin/curl”,”-k”,”-u”,userName+”:”+password,”\””+hostIP+”\””,”-o” ,csvDownloadPath+”ggggg.csv”);
      Process p = pb.start();
      InputStream is = p.getInputStream();
      System.out.println(“command running “);
      }
      catch(Exception e){
      e.printStackTrace();
      System.out.println(“command running through “);

      Actually running this…
      plz guide me , Thanks In advance

Leave a Reply Cancel reply

Popular Posts

  • How to Install Python 3.9 on CentOS/RHEL 7 & Fedora 32/31 0
  • How To Install VNC Server on Ubuntu 20.04 1
  • How To Install NVM on macOS with Homebrew 0
  • (Solved) apt-add-repository command not found – Ubuntu & Debian 0
  • How to Install .NET Core on Debian 10 0
© 2013-2020 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy