I am looking for a CLI download tool that can change the bandwidth limit during downloading.
Most CLI download tools I know can set a bandwidth limit, but the limit can not be changed during downloading.
No. The main tools for this are wget
and curl
and those are not interactive.
Both wget
and curl
do understand that you can kill and resume the download: if you want to change the speed in the middle of a download and you used the -c
switch with the --limit-rate=x
(for wget
) or --limit-rate x
(for curl
) then you can stop wget
or curl
and restart it with a different speed.
There is another tool called tc (netem also uses tc
) but this will limit the rate for the network interface of the computer. It uses a Token Bucket Filter (TBF). 1 example (more here)
# tc qdisc change dev eth0 root netem delay 100ms 10ms 25%
This causes the added delay to be 100ms ± 10ms with the next random element depending 25% on the last one. This isn't true statistical correlation, but an approximation.
Mind that the issue of not stressing out your system can be avoided with another option --wait=seconds
. From the wget manual:
Wait the specified number of seconds between the retrievals. Use of this option is recommended, as it lightens the server load by making the requests less frequent. Instead of in seconds, the time can be specified in minutes using the "m" suffix, in hours using "h" suffix, or in days using "d" suffix.
Specifying a large value for this option is useful if the network or the destination host is down, so that Wget can wait long enough to reasonably expect the network error to be fixed before the retry. The waiting interval specified by this function is influenced by "--random-wait", which see.
It is similar to the usage of the Crawl-delay
directive in robots.txt
.