Wget

 

Overview

This article explains what Wget is and how to use this tool at DreamHost.

Prerequisites

This article assumes you have Created a Shell user and are logged into your server via SSH.

Background

Wget is a program that retrieves content from web servers. It is named after the World Wide Web and Get.

When to use Wget

Wget is often used after logging into your server via SSH to download files from a remote server to your DreamHost server. This is a much faster and easier option than manually downloading the files via FTP from the source and then uploading them to your server.

rsync may be a better (and faster, less complicated) option for users moving data between two servers (such as moving files from Shared to VPS hosting).

How to use Wget

You can use the Wget command to run simple and advanced tasks on your server.

Viewing the manual

To view the manual page for Wget, run the following in your terminal:

[server]$ man wget 

Downloading a file

To download a file to your server:

Type in wget followed by the full URL of the file you wish to download. For example, run the following command to download the .tar.gz file for Python version 3.8.1:

[server]$ wget https://www.python.org/ftp/python/3.8.1/Python-3.8.1.tgz
  • This downloads the .tgz file to the directory where you ran the command.
  • If the file you download is compressed, decompress the file using gunzip, unzip, or tar to expand and unpack the download.

If you need to pass variables to a script, enclose the URL in single quotes, which prevents the ampersand character from being interpreted as the shell command:

[server]$ wget 'https://www.example.com/myscript.php?var1=foo&var2=bar'

See also

DreamHost links

Third-party links

Did this article answer your questions?

Article last updated PST.

Still not finding what you're looking for?