Monday 18 November 2019

How to Use curl to Download Files From the Linux Command Line

A terminal window on a Ubuntu-style Linux desktop.
Fatmawati Achmad Zaenuri/Shutterstock

The Linux curl command can do a whole lot more than download files. Find out what curl is capable of, and when you should use it instead of wget.

 curl vs. wget : What’s the Difference?

People often struggle to identify the relative strengths of the wget and curl commands. The commands do have some functional overlap. They can each retrieve files from remote locations, but that’s where the similarity ends.

wget is a fantastic tool for downloading content and files. It can download files, web pages, and directories. It contains intelligent routines to traverse links in web pages and recursively download content across an entire website. It is unsurpassed as a command-line download manager.

curl satisfies an altogether different need. Yes, it can retrieve files, but it cannot recursively navigate a website looking for content to retrieve. What curl actually does is let you interact with remote systems by making requests to those systems, and retrieving and displaying their responses to you. Those responses might well be web page content and files, but they can also contain data provided via a web service or API as a result of the “question” asked by the curl request.

And curl isn’t limited to websites. curl supports over 20 protocols, including HTTP, HTTPS, SCP, SFTP, and FTP. And arguably, due to its superior handling of Linux pipes, curl can be more easily integrated with other commands and scripts.

The author of curl has a webpage that describes the differences he sees between curl and wget.

Installing curl

Out of the computers used to research this article, Fedora 31 and Manjaro 18.1.0 had curl already installed. curl had to be installed on Ubuntu 18.04 LTS. On Ubuntu, run this command to install it:

sudo apt-get install curl

sudo apt-get install curl in a terminal window

The curl Version

The --version option makes curlreport its version. It also lists all the protocols that it supports.

curl --version

Read the remaining 71 paragraphs



from How-To Geek https://ift.tt/2XlTkj8

No comments:

Post a Comment