Network

The curl command

Requests a URL and shows the response. The command to talk to web services.

Syntax

curl [opciones] <url>

Most useful options

-OSaves with the remote file name
-oSaves with the name you give
-IShows only the headers
-LFollows redirects

Copy-ready examples

$ curl miguelacm.esSee the HTML
$ curl -I miguelacm.esOnly the headers
$ curl -o pagina.html miguelacm.esSave it into a file

You can try them in the browser terminal: it does not touch your computer.

Typical mistakes

  • By default it prints on screen: if it is a binary you will see garbage.

Related commands

FAQ

curl or wget?

curl is more versatile for APIs; wget is designed for downloading files.

Learn to actually use it

The basic Linux course takes you from zero to console fluency with 24 self-grading lessons.

Start the free course