How to Set a Quota Limit in Wget?

This article provides a quick overview and practical guide on how to restrict the total amount of data downloaded during a wget session. By using the built-in quota flag, you can prevent large download jobs from consuming all your disk space or exceeding network bandwidth caps. You will learn the exact syntax for setting these limits, how wget behaves when a quota is reached, and the structural limitations of this feature when downloading single versus multiple files.

The Wget Quota Syntax

To enforce a maximum download size limit in wget, you use the --quota option (or its short-form equivalent -Q). This tells the utility to keep track of the cumulative bytes downloaded during the session and stop fetching new resources once the specified threshold is crossed.

The basic syntax for the command is:

wget --quota=NUMBER URL

The NUMBER value can be postfixed with specific letters to denote the unit of measurement:

For example, to limit a download session to 500 Megabytes, you would run:

wget --quota=500m http://example.com/downloads/

Critical Behavior and Limitations

Understanding how wget handles the quota limit is essential to avoid unexpected disk usage, as the feature behaves differently depending on how many files you are downloading.