
We can create a file by using the -o (output) option, and telling curl to create the file. We don’t have to redirect the output to create a file.

It didn’t do this in the previous example because the progress information would have been scattered throughout the web page source code, so curl automatically suppressed it. Because there is no terminal window output to display, curl outputs a set of progress information. This time we don’t see the retrieved information, it is sent straight to the file for us. Let’s tell curl to redirect the output into a file: curl > bbc.html The shell may try to interpret some of the byte values in the binary file as control characters or escape sequences. If the file it is retrieving is a binary file, the outcome can be unpredictable. curl īut its default action is to dump it to the terminal window as source code.īeware: If you don’t tell curl you want something stored as a file, it will always dump it to the terminal window. If we point curl at a web page, it will retrieve it for us. It also lists all the protocols that it supports. The -version option makes curlreport its version. On Ubuntu, run this command to install it: sudo apt-get install curl curl had to be installed on Ubuntu 18.04 LTS. Out of the computers used to research this article, Fedora 31 and Manjaro 18.1.0 had curl already installed. The author of curl has a webpage that describes the differences he sees between curl and wget.

And arguably, due to its superior handling of Linux pipes, curl can be more easily integrated with other commands and scripts.

curl supports over 20 protocols, including HTTP, HTTPS, SCP, SFTP, and FTP. 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.Īnd curl isn’t limited to websites. 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. Yes, it can retrieve files, but it cannot recursively navigate a website looking for content to retrieve. Curl satisfies an altogether different need.
