HowTo Download From The Command Line Using: "wget"

From NST Wiki
Jump to: navigation, search

HowTo Continue to Retrieve A Partially-Downloaded File With: "wget"

The "wget" command has a "--continue" option for downloading a file that has not been completely retrieved. This is a handly option to use when dealing with large file sizes (i.e. greater than 500MBs) and the connection has stopped. Restarting the download with the "--continue" option will continue the retrieval process from the last byte that was downloaded.

Command: "wget" Using: "--continue" option.
[root@probe tmp]# wget --continue http://www.linux-freeware.org/ftp/download/treebuild.src


HowTo Get The HTTPD Headers

The following commands show how one can view the HTTPD header information returned by a web server and discard the results. The second example demonstrates how to do this when authorization is required by retrieving the information from a NST system:

Command: "wget" Using: "-S" option.
[root@probe ~]# wget -S -O /dev/null http://www.google.com/
--10:33:34-- http://www.google.com/ => `/dev/null' Connecting to 192.168.20.100:3128... connected. Proxy request sent, awaiting response... unspecified HTTP/1.0 200 OK Cache-Control: private Content-Type: text/html; charset=ISO-8859-1 Set-Cookie: PREF=ID=55021cbfbbbc458f:TM=1187879619:LM=1187879619:S=W716ANJU_0IJDXSG; expires=Sat, 22-Aug-2009 14:33:39 GMT; path=/; domain=.google.com Server: GWS/2.1 Date: Thu, 23 Aug 2007 14:33:39 GMT X-Cache: MISS from probe.localdomain Proxy-Connection: close Length: unspecified [text/html] [ <=> ] 5,143 --.--K/s 10:33:39 (1.02 MB/s) - `/dev/null' saved [5143]
[root@probe ~]# wget -S -O /dev/null --no-check-certificate --user root \
--password NST_PASSWORD https://192.168.20.120/nstwui/cgi-bin/time/milliseconds.cgi
--10:38:15-- https://192.168.0.247/nstwui/cgi-bin/time/milliseconds.cgi => `/dev/null' Connecting to 192.168.0.247:443... connected. WARNING: Certificate verification error for 192.168.0.247: self signed certificate WARNING: certificate common name `www.networksecuritytoolkit.org' doesn't match requested host name `192.168.0.247'. HTTP request sent, awaiting response... HTTP/1.1 200 OK Date: Thu, 23 Aug 2007 14:38:08 GMT Server: Apache Expires: Thu, 23 Aug 2007 14:38:08 +0000 Cache-Control: no-cache, must-revalidate Pragma: no-cache Last-Modified: Thu, 23 Aug 2007 14:38:08 GMT Connection: close Content-Type: text/plain; charset=ISO-8859-1 Length: unspecified [text/plain] [ <=> ] 2 --.--K/s 10:38:15 (63.00 KB/s) - `/dev/null' saved [2]
[root@probe ~]#