Limit size wget can download

bash, unix, wget

Solution

Leveraging the ability for the system to limit processes resource consumption through the `ulimit` command should just work. Assuming you use bash:

(ulimit -f 102400; wget $url)

Here the size is in 1024 bytes blocks. Note that if you use a different still standard compliant shell, or use `bash` in POSIX mode, the block size is 512 bytes so the command should be:

(ulimit -f 204800; wget $url)

Problem

Is it possible to limit or cap the amount of data `wget` downloads from a site? Either via server setting or `wget` setting? For example, one page is 1GB size, I want wget to stop downloading at 100MB.

Original source