How to download files using linux command line

When we use linux, we often encounter the situation of downloading files, so how do we use commands to download files in linux?

Today, I want to share with you two commonly used file download commands:

  • wget
  • curl


curl [options] [URL...]
wget [option]  [URL]


  • -L, –location
            (HTTP)  If the server reports that the requested page has moved to a different location (indicated with a Location: header and a 3XX response code), this option will make curl redo the  request on the new place.
  • -d, –data <data>
            (HTTP) Sends the specified data in a POST request to the HTTP server
  • -o, –output <file>
            Write output to <file> instead of stdout.
  • -O, –remote-name
      Write output to a file named as the remote file
  • -H, –header <header/@file>
    Pass custom header(s) to server
  • -e, –referer <URL>
    Referrer URL


  • -o logfile
          Log all messages to logfile.
  • -a logfile
          Append to logfile.


Use wget to download files

In the following example, we will use the wget command to download the ubuntu iso file. It is recommended to enclose the URL in double quotation marks (“).

wget ""

If you want the standard output not to output content, you can use the -o or -a option to write the output to the log file.

wget "" -o logfile

Use curl to download files

In the following example, we will use the curl command to download the Ubuntu iso file.

curl -o ubuntu.iso

curl -O

This entry was posted in Linux File & Directory and tagged , , . Bookmark the permalink.