Difference between revisions of "The Web from the Command Line"

From LMU BioDB 2017
Jump to: navigation, search
(Start writing out curl page.)
(No difference)

Revision as of 01:47, 11 September 2017

Due to the “need-to-know” approach that we take in this course, our study of the command line necessarily takes a leap to a fairly powerful and advanced command. This command beings the web to the command line, and learning it helps one understand what is truly happening behind the scenes when we visit websites with our web browsers. That command is curl. Strictly speaking, it is spelled cURL because its name is intended to mean “see URL.” “See” and “c”—get it?

Basic Usage

Put simply, curl performs single web requests and displays the response provided by the contacted web server without further processing (nor layout). In its simplest form, one can just give it a URL:

curl http://www.lmu.edu

For most URLs, invoking this command will produce a flood of text—a perfect use case for more/less, or for output redirection in case you want to save the file to your computer:

curl http://www.lmu.edu > lmu.html

That’s it, really. Using curl, you can get the content of a web page purely at the data level. No images are loaded, no layout is done, no visuals are rendered. This command is like the very first step that a web browser takes when visiting a website, except that it goes no further than that.