wget is a great and simple command line tool that you can use to download a file (image, gz, binary etc.) that is located some where remotely on a web server.
e.g. you can see how wget is used below to download an image from a web server.
man-mini:~ mvohra$ wget http://content.gopixora.com/uploads/f-7-2568-1.png
--2014-01-03 13:46:23-- http://content.gopixora.com/uploads/f-7-2568-1.png
Resolving content.gopixora.com... 184.108.40.206
Connecting to content.gopixora.com|220.127.116.11|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1353403 (1.3M) [image/png]
Saving to: `f-7-2568-1.png'
100%[===================================>] 1,353,403 87.4K/s in 18s
2014-01-03 13:46:41 (73.7 KB/s) - `f-7-2568-1.png' saved [1353403/1353403]
It will download that file in the same folder from where the command was run from. Along with that it provides information about the size of the file and displays real time, the speed at which the file is getting downloaded. Wget comes installed on Unix OS by default but it is not available on the Mac OSX out of the box. However you can build it from the original source code and install it as follows:
Download Source, Build and Install
- Download the wget source.
Yo can download the sources from the GNU ftp site by using the web browser and save it locally or download it via the command line using the curl
OR use curl as follows:
curl -O http://ftp.gnu.org/gnu/wget/wget-1.14.tar.gz
Uncompress the downloaded source file as:
tar -xzf wget-1.14.tar.gz
Now cd (change directory) to the uncompressed directory as:
Now configure the sources for build with the –with-ssl
flag to prevent a “GNUTLS not available” error as:
Build the source using the make command:
Finally install the wget that was just built using the following command :
sudo make install
Enter the root password when asked, it will install wget in the /usr/local/bin folder.
Test your install using the following command:
It will display a big output. Now you can delete the .gz file and uncompressed folder
rm -rf wget-1.14