wget is a very versatile Linux application and available for just about every distribution in existence. It's predominant use is downloading files from various sources on the internet and tends to used http, https, ftp and sftp protocols.
By default wget will save the files you request to the current directory where you run the wget command. i.e. if you type pwd (Present Working Directory) and you happen to be in /home/connektiv8 (the home folder of the user you're logged in as) and you're presently in that directory, wget will download to the current folder. You can also specify where to download to using parameters though we'll get further into the weeds shortly.
Following are some basic commands for wget for basic tasks, along with some of the parameters you can use for some fairly common scenarios.
Download a website
To download a website page you can issue the following command:
wget http://www.examplewebsite.com/
To download a specific file where you know the exact location of the file:
wget ftp://techlab.connektiv8.com/kfc-secret-saucecode.tar.gz
where you're specifying:
a) the FTP protocol, as denoted by the ftp:// prefix to the URL
b) the URL itself, ftp.examplewebsite.com
c) the exact filename including it's extension
If you're downloading a file that's stored in a folder within an Apache public website, you would use http:// or https:// as the protocol, so your command line swould look like the following instead:
wget http://techlab.connektiv8.com/kfc-secret-saucecode.tar.gz
wget https://techlab.connektiv8.com/kfc-secret-saucecode.tar.gz
Downloading files from FTP
When you want to download a file via FTP it will be assumed that you'll use port 21 given this is the default for FTP.
You can also specify a different port as part of the command line also using the following format:
ftp://host:port/directory/file
An example of this would be as follows:
wget ftp://ftp.examplewebsite.com/downloads/kfc-11-herbs-and-spices.tar.gz
If the FTP requires a username and password, an example of the command-line format would be:
wget ftp://username:password@ftp.examplewebsite.com/downloads/kfc-11-herbs-and-spices.tar.gz
Putting this all together a command-line format for specifying a username, password, port, folder and filename would be:
wget ftp://username:password@ftp.examplewebsite.com:20/downloads/kfc-11-herbs-and-spices.tar.gz
Discussion