/ factorpad.com / tech / linux-essentials / wget-command.html
An ad-free and cookie-free website.
Beginner
Learn to download files at the Linux command line.
Videos can also be accessed from the Linux Essentials Playlist on YouTube.
Linux wget Command Summary with Examples (3:40)
Our eighty-fifth word, or command to memorize is
wget
from our category
Communication.
wget
allows you to download files
non-interactively.
-options | description |
---|---|
-h ,
--help |
Print help screen |
-b ,
--background |
Operate in the background |
-a ,
--append-output=FILE |
Append messages to FILE |
Recall from the last video (tutorial) on
ftp
we manually logged in to a remote
site, and now we'll download files non-interactively.
Before we start, it helps to think of commands as mini programs and
most follow this structure:
command -option(s) argument(s)
.
The wget
command has
over 130 options, and yes, I counted. (Please review
man wget
.) The argument is
the URL, or Uniform Resource Locator, which is that long field at the
top of your browser pointing to a file using a variety of Protocols,
normally http, but could also be
https, ftp and others.
Like most commands, help is available with double-dash
--help
. The
-b
option will kick time-intensive
operations into the background, and
-a
will append messages to a specified
log file.
So why is wget
an important command?
Well, organizations, like search engines, need an automated way to
scrape and process information from the Internet.
And now you know how to do that.
Okay, the best way to embed this in your memory is by typing in your own terminal window.
Find this on your Mac using a program called Terminal. On Linux use Terminal or Konsole, and currently Microsoft is adding this functionality to Windows.
Here we go. So wget can get very complex, but let's
try it for something simple, and something I've been curious about.
Let's use less
to see if that
simple-looking Google homepage is simple.
(The output below is a subset of the html file downloaded from the google.com home page.)
Okay, well looking at it, it doesn't seem as complex as you might
think (sarcasm intended), although the formatting is kind of strange
here (no sarcasm intended here). ;)
And next, there's another public file I know something about, it's a
data set I use for teaching an investment modeling boot camp on
YouTube, the file is at
factorpad.com/returns.txt
.
And then last, let's review it using head
.
It has returns on four stocks, an Index and Treasury bills for 5-years and we use that to geek out on Statistics in Finance (Quant 101). Check that out if you are interested.
Okay now you know how to use wget
.
And you know the syntax for commands, options and arguments.
One last tip about the wget
command. So wget
can also take a long
list of files as input, it can follow links recursively and it'll
even eat cookies.
Okay, thanks for visiting today. I hope this was a helpful
introduction to the wget
command.
For an overview of the 100 videos, the 8 quizzes, a cheat sheet, the categories and a Q&A section, visit:
Free learning content here is growing. Connect so you don't miss something relevant for your progress.
ftp
command, hit
Back.ssh
command,
click Next./ factorpad.com / tech / linux-essentials / wget-command.html
A newly-updated free resource. Connect and refer a friend today.