GNU wget

GNU wget

Last Updated on 2017-02-27 by Sture

Description

GNU wget is a free software package for retrieving files using HTTP, HTTPS and FTP, the most widely-used Internet protocols. It is a non-interactive command-line tool, so it may easily be called from scripts, cron jobs, terminals without X-Windows support, etc.

GNU wget has many features to make retrieving large files or mirroring entire web or FTP sites easy, including:

  • Can resume aborted downloads, using REST and RANGE
  • Can use filename wild cards and recursively mirror directories
  • NLS-based message files for many different languages
  • Optionally converts absolute links in downloaded documents to relative, so that downloaded documents may link to each other locally
  • Supports HTTP and SOCKS proxies
  • Supports HTTP cookies
  • Supports persistent HTTP connections
  • Unattended / background operation
  • Uses local file timestamps to determine whether documents need to be re-downloaded when mirroring
  • GNU wget is distributed under the GNU General Public License.

WWW: http://www.gnu.org/software/wget/wget.html

Preparation for Installation

Start PuTTY on a Windows PC, Terminal on a Mac or similar terminal application on a Linux PC.

In this example Terminal on a Mac is used.

Open a remote SSH session to the server with:

Mac:~ user$ ssh user@192.168.1.4 [enter]
N.B.: Replace user@192.168.1.4 with User ID and IP Address on Your server!
[user@server ~]$

Enable superuser privileges with:

[user@server ~]$ sudo -s [enter]
Password: <-- passwd [enter]
[root@server /usr/home/user]#

N.B.: Enter user password, not the root password!

Install

Install wget with:

[root@server /usr/home/user]# pkg install wget [enter]
Updating FreeBSD repository catalogue...
FreeBSD repository is up-to-date.
All repositories are up-to-date.
The following 1 package(s) will be affected (of 0 checked)
New packages to be INSTALLED:
wget: 1.18_2

Number of packages to be installed: 1

The process will require 3 MiB more space.
578 KiB to be downloaded.

Proceed with this action? [y/N]: y [enter]
Fetching wget-1.18_2.txz: 100% 578 KiB 592.0kB/s 00:01
Checking integrity... done (0 conflicting)
[1/1] Installing wget-1.18_2...
[1/1] Extracting wget-1.18_2: 100%
[root@server /usr/home/user]#

List all installed files with:

[root@server ~]# pkg info -l wget | less [enter]

Configure

No configuration required.

How to Use

Since Wget uses GNU getopt to process command-line arguments, every option has a long form along with the short one. Long options are more convenient to remember, but take time to type. You may freely mix different option styles, or specify options after the command-line arguments. Thus you may write:

[root@server ~]#  wget -r --tries=10 http://www.example.com/ -o log [enter]

The space between the option accepting an argument and the argument may be omitted. Instead of -o log you can write -olog.

Leave a Reply