How to limit total download size with wget

A total quota keeps one wget run from consuming more disk space or bandwidth than the job can spare. It matters most when the transfer pulls from a URL manifest or another automatic retrieval where the final size is not obvious before the run starts.

GNU wget applies this cap with --quota or -Q and accepts plain bytes plus k and m suffixes. The quota is checked only after each file completes, so the file that crosses the limit still finishes and then stops the rest of the retrieval.

That end-of-file check is the main caveat for this page. Keep quota-controlled runs in their own directory so the actual bytes on disk are easy to inspect, and use --quota=0 or --quota=inf only when you intentionally want the same manifest to run without a size cap.

Steps to limit total download size with wget:

  1. Save the target URLs in urls.txt.
    urls.txt
    https://downloads.example.net/exports/catalog-064k.bin
    https://downloads.example.net/exports/inventory-delta-096k.bin
    https://downloads.example.net/exports/media-index-160k.bin

    Run the quota test from an empty working directory so the manifest and downloaded files stay easy to audit or remove.

  2. Run wget with the quota value and let it stop after the file that exhausts the budget finishes downloading.
    $ wget --quota=200k --input-file=urls.txt --directory-prefix=downloads
    ##### snipped #####
    Saving to: 'downloads/catalog-064k.bin'
    2026-04-22 06:36:04 (2.77 GB/s) - 'downloads/catalog-064k.bin' saved [65536/65536]
    ##### snipped #####
    Saving to: 'downloads/inventory-delta-096k.bin'
    2026-04-22 06:36:04 (876 MB/s) - 'downloads/inventory-delta-096k.bin' saved [98304/98304]
    ##### snipped #####
    Saving to: 'downloads/media-index-160k.bin'
    2026-04-22 06:36:04 (20.6 MB/s) - 'downloads/media-index-160k.bin' saved [163840/163840]
    
    FINISHED --2026-04-22 06:36:04--
    Total wall clock time: 0.2s
    Downloaded: 3 files, 320K in 0.008s (40.5 MB/s)
    Download quota of 200K EXCEEDED!

    The quota does not truncate a file mid-transfer, so a single large file can push the final total past the configured limit.

  3. Check the actual bytes on disk before treating the quota as the final stored size.
    $ du -sh downloads
    320K    downloads
    $ ls -lh downloads
    total 320K
    -rw-r--r-- 1 user user  64K Apr 22 06:36 catalog-064k.bin
    -rw-r--r-- 1 user user  96K Apr 22 06:36 inventory-delta-096k.bin
    -rw-r--r-- 1 user user 160K Apr 22 06:36 media-index-160k.bin

    Use --quota=0 or --quota=inf when you want the same manifest to run without the cap.